I am cycling through a return set and trying to capture the result in a concatenated string. I have verified that I get a valid return value and also verified the quantity in the return value.
This works
while ( $i < $num) {
$bone .= "<item> <record_num>" . mysql_result($result, $i,'record_num') . "</record_num>" .
"<date_field>" . mysql_result($result, $i, 'date_field') . "</date_field>" .
"<description>" . mysql_result($result, $i, 'description') . "</description> </item>";
$i++;
This does not work
while ($row = mysql_fetch_row($result)){
$bone .= "<item> <record_num>" . $row['record_num'] . "</record_num>" .
"<date_field>" . $row['date_field'] . "</date_field>" .
"<description>" . $row['description'] . "</description> </item>";
}
In the code that does not work I get all the information but the actuall variable, $row[‘date_field’] and the like. I have tried mysql_fetch_rows, mysql_fetch_arrays, and mysql_fetch_assoc.
Here is an example of what is returned.
<Item> <record_num></record_num><date_field></date_field><description></description> </item>
<item> <record_num></record_num><date_field></date_field><description></description> </item>
<item> <record_num></record_num><date_field></date_field><description></description> </item>
…
Please point out what I am doing incorrectly.