|
Posted by Rik on 01/10/07 01:15
scotty wrote:
> Can someone help is there a way to get a single record from an array
> The following code displays all the records. I want to display the
> first record only then go to next page and display the second
> record and either go to next page and display the third record or go
> back to the first record again.
>
> $query = mysql_query("SELECT * FROM table_name");
>
> while($data = mysql_fetch_array($query))
> {
> $firstname = $data["firstname"];
> $lastname = $data["lastname"];
> $phone = $data["phone"];
> echo("$firstname $lastname number is $phone");
> }
> Thanks in advance
I'd limit the query, as it has useless overhead:
$page = 0;//or some logic to make it 1,2,3 etc.
$query = mysql_query("SELECT * FROM table_name LIMIT $page,1");
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|