Hi all,
I am trying to capture my query results in a string so that I can then pass that string to a javascript output display but am fairly new to PHP and am not sure which direction to head.
My code is:
$result = mysql_query("select * from company ") or die(mysql_error());
while($grRow = mysql_fetch_array($result)){
$id = $grRow[1];
$des = $grRow[7];
$display = "$id $des";
}
echo "var msg=' $display'";
My javascript variable msg is then passed to a javascript function and the above code works fine except that it will only pass the values from the first result. I want to display a string containing $id and $des from all of the results so that the value of $display looks like $id $des $id $des $id etc...
How do I capture all the values in one long string so that I can display them elsewhere?
Thanks.