I am pulling a recordset from a database and I want all of the data from one column to collect into a single variable i can echo. Is there anyway to collect everything into one string I can parse out?
hakre
2:09 am on Feb 17, 2005 (gmt 0)
if you want to echo, i think print_r($row) should do the job. if you need to have it in one line, check the array functions for merging one array like implode().
cremesoda201
2:24 am on Feb 17, 2005 (gmt 0)
Here is what I have so far. But it is repeating the same record for how many records there are. I want it to display each city it pulls.
<?PHP
for ($x=0;$x<$totalRows_cities;$x++) { $citylist .= $row_cities['city']; };
?>
<?PHP echo $citylist;?>
coopster
4:08 am on Feb 17, 2005 (gmt 0)
Welcome to WebmasterWorld, cremesoda201.
You need to do the concatenation within your while [php.net] loop.
$my_var = ''; // initialize while ($row = fetch_array from database result set) { $myvar .= ',' . $row['my_column']; // comma-separated values }