Re: Mysql Rows
| From: | Miles Thompson | Date: | Sat, 04 Mar 2006 13:19:47 +0000 |
| Subject: | Re: Mysql Rows | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-231446@lists.php.net to get a copy of this message | ||
I hope the following will be helpful, and it is a bit of a rant ..
<rant>
The row number DOES NOT MATTER and is absolutely irrelevant. MySQL is a relational database from which information is gathered by means of comparing fields to key values. Even if you are using an auto-incremented primary key it serves ONLY AS A LABEL to UNIQUELY identify each row.
If you need sequential numbers, as for membership, devise a script to manage them and recycle them, if that's what you want.
For the number of returned rows, check mysql_row_count (or similar function).
Recognize that an ORDER BY condition will change the apparent row number.
</rant>
I am v. curious as to why you need to know which row is used for jimmy.
Regards - Miles
At 07:51 PM 3/3/2006, benifactor wrote:
i need to find a way to find out what number of a row is in a database... for example: //this is the database Username: Chuck Password: adsasa Username: jimmy Password: adsf Username: stewart Password: dfds the information i need is what row jimmy resides on.. this is what i tried: function i_gun ($user) { global $username; $gun = mysql_query("select * from users"); while ($d = mysql_fetch_array($gun)) { while($d[username] != $user) { $i = $i + 1; } } } but it always returns 1. can sombody tell me what i am doing wrong or point me in the right direction in the manual? plase and thank you-- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.1.375 / Virus Database: 268.1.2/274 - Release Date: 3/3/2006