Getting the first row of the mysql resource string?

Posted by mrNepal on Stack Overflow See other posts from Stack Overflow or by mrNepal
Published on 2011-01-06T11:52:29Z Indexed on 2011/01/06 11:53 UTC
Read the original article Hit count: 123

Filed under:
|
|

Here is my problem. I need more than one row from the database, and i need the first row for certain task and then go through all the list again to create a record set.

$query = "SELECT * FROM mytable";
$result = mysql_query($query);

$firstrow = //extract first row from database
//add display some field from it


while($row = mysql_fetch_assoc($result)) {
   //display all of them
}

Now, how to extract just the first row?

© Stack Overflow or respective owner

Related posts about php

Related posts about mysql