I want to display the string in comma separated by comma
Here is my code
function GetItemIds()
{
$i=0;
$query="SELECT item_id FROM common.items ORDER BY item_id DESC LIMIT 10";
$str="";
$result= mysql_query($query);
while($result1= mysql_fetch_row($result))
{
if($i==0)
{
$str .= $result1[0];
}
else
{
$str .=",".$result1[0];
}
}
echo $strs;
}
but here I print str I have output 12345678 like this but I want 1,2,3,4 so please help me
Thanks in advance
A better way: