Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.