mysql - How to make a php variable equal to the result of mysql_fetch_array? -
$query = mysql_query("select * fruit color='red' "); while ($row = mysql_fetch_array($query)) { echo $row['name']."|" ;// echo apple|strawberry|cherry }
how make php variable equal result of mysql_fetch_array? need make equal like: $newname="apple|strawberry|cherry"
, can use new variable $newname
process. thanks.
rather echo, concatenate:
$newname = ''; while ($row = mysql_fetch_array($query)) { $newname .= $row['name']."|" ;// echo apple|strawberry|cherry } $newname = rtrim($newname,'|');
Comments
Post a Comment