The code above produces the result above.Code:code $testResult=mysql_query("select id, name from myTable order by id ") ; while($row = mysql_fetch_array($testResult)) { $myRecord="(". $row['id'].")".$row['name']." <br>"; echo $myRecord; } result (id) name (1) Tom (2) Mary (3) Jane (4) Jack
I like to get the same result above by using one variable named "myWholeResult".
The code below which is one of trial for it doesn't work correctly, but I hope it shows what I want.
Code:trial code $testResult=mysql_query("select id, name from myTable order by id ") ; $myWholeResult = while($row = mysql_fetch_array($testResult)) { $myRecord="(". $row['id'].")".$row['name']." <br>"; echo $myRecord; }; echo $myWholeResult; target result (1) Tom (2) Mary (3) Jane (4) Jack



Reply With Quote

Bookmarks