javascript - Remove commas from php array -


I am currently working on displaying some arrays using PHP and MySQL.

The simplified code looks like this:

  $ sql = "select from the program"; $ Result = mysqli_query ($ dbc3, $ sql); $ Tryout_reports = array (); While ($ line = mysqli_fetch_assoc ($ result)) {$ tryout_reports [] = $ line ['file_name'] "
"; } $ Detail_report ['tryout_reports'] = $ tryout_reports;

I have extracted a lot from SQL, so if there is something wrong with it, please do not pay attention. SQL statement works fine.

The problem is that each value is being output from comma separated, and it looks really bad.

When the run is running, the HTML looks like this:

File 1.pdf & lt; Br> "," File 2.pdf & lt; Br> "," e.t.c.

Now, I have seen a bit and I have tried the following:

  ltrim () rtrim () explosion (str_replace) Code>  

I know that rtrim works, but it does not remove the comma, I tried to do something like this:

  $ tryout_reports [] = rtrim ( $ Line ['file_name'], "pdf");  

And it took the PDF out of the end of every one, but when I replace "pdf" with "", then it does nothing.

Actually stuck,

EDIT: Forgot to add, this page that uses this data and displays on the page is in it:

table.append ("<< tr> Tryout Reports " + Data [0]. Tryout_reports + "& lt; / td> & lt; / tr & gt;");

This is inside a jQuery function which clicks the job number to display additional information.

This comma comes from javascript because you directly parse the array, you may join: w3schools .com / jsref / jsref_join.asp


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -