How can get first record from mySQL table?

manojkumarmaithil's Avatar, Join Date: Jun 2007
Go4Expert Member
PHP Code:

$query  "SELECT * FROM newuser ORDER BY entrydate";
$sql_query =mysql_query($query,$db);
while($row = mysql_fetch_array($sql_query, MYSQL_ASSOC))
<td><? echo $row["fullname</td>
<td><? echo $row["address"];?></td>
<td><? echo $row["admincheck"];?></td>
<td><? echo $row["entrydate"];?></td>
When we run this code then it produce list form second record. How can I get first record from Table?

Any Idea!

Last edited by shabbir; 11Jan2008 at 19:26.. Reason: Code block
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Still you don't seem to get how to Post a Query as a thread and submit an article. You have submitted the above thread as an article and I have moved it to the forum.
pradeep's Avatar, Join Date: Apr 2005
Team Leader
Code: SQL
SELECT * FROM newuser ORDER BY entrydate LIMIT 1

You may also use "SELECT * FROM newuser ORDER BY entrydate" but use if() instead of while()
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
The problem is you are executing the statement mysql_fetch_array twice before printing the result for the first time and so its getting from the record number 2