I am fetching some set of ids from database and want to print them comma separated using php implode() method.
But it is giving me a warning that I passed invalid arguments to implode. So why do I get this warning and how can I fix my code, to get the id's comma separated?
<?php
session_start();
if(isset($_SESSION['tstid']))
{
$tstid = $_SESSION['tstid'];
}
include('references.php');
include('config.php');
$query = "select * from testquestions where testid='".$tstid."'";
$res = mysql_query($query);
if(mysql_num_rows($res) > 0)
{
while($fetch = mysql_fetch_array($res))
{
$z =implode(', ', $fetch['qid']);
}
echo $z;
}
?>