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

Popular posts from this blog

Javascript line number mapping -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -