Jump to content

Reset number


I-AM-OBODO

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/199875-reset-number/
Share on other sites

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

}

Link to comment
https://forums.phpfreaks.com/topic/199875-reset-number/#findComment-1049117
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.