I-AM-OBODO Posted April 27, 2010 Share Posted April 27, 2010 Helo. I am not sure what to call my subject, but what am asking is this: in my db i am a column for serial number, lets say i want a couple rows for a particular user who has many entries (in the db his entries might be in serial number 4, 7, 15, 100 etc) is there a way that i can sieve the output so i just get 1, 2, 3 etc for that user and any user base on my comand? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/199875-reset-number/ Share on other sites More sharing options...
greatstar00 Posted April 27, 2010 Share Posted April 27, 2010 put your result into array? like this $q=mysql_query(select * from table1 where user='user1') $arr=array(); $i=1; while($rc=mysql_fetch_array($q)){ foreach($rc as $key =>$value){ $arr[$i][$key]=$value;// replace $key with 'user' if you only want to display 'username' } } //now, when you echo like this foreach ($arr as $key=>$value){ echo $key.' '.$value['user'];//you will see for example: 1 John } Quote Link to comment https://forums.phpfreaks.com/topic/199875-reset-number/#findComment-1049117 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.