Hello Guys my name is Azeem and i am working on php / mysql i want to showing ids from table and make code this <?php $sql="select * from $table where cat_id=$cat_id"; $result=mysql_query($sql); while($rs=mysql_fetch_array($result)) { echo $id=$rs['id'].","; ?> and showing result like this 1,2,3,4, but i want result like this 1,2,3,4 means not include coma(,) in last digit anyone tell me that how can i do this ? please help me i am thank to yours
Change it to something like <?php $i = 0; $sql="select * from $table where cat_id=$cat_id"; $result=mysql_query($sql); while($rs=mysql_fetch_array($result)) { if ($i<>0) echo ','; echo $id=$rs['id']; $i++; } ?> Code (PHP):