Here is my code:
<?PHP
$r = mysql_query("SELECT * FROM `statistics` order by DAY desc");
while($rowi = mysql_fetch_assoc($r))
{
$v = addslashes($rowi['visits']);
$visits = array($v);
}
echo "<h1>$visits</h1>";
?>
I want to create echo result looking like this:
"January", "February", "March", "April", "May", "June", "Jul"
But my code is not working. Can you help me out, i do not understand where is my mistake.
Thanks in advance!
try this code you have to append item to array insde your while loop
$r = mysql_query("SELECT * FROM `statistics` order by DAY desc");
$visits = array();
while($rowi = mysql_fetch_assoc($r))
{
$v = addslashes($rowi['visits']);
$visits[] = $v;
}
echo implode(",",$visits);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.