PHP Database problem

AH_Viper

Spy
Joined
Jul 20, 2003
Messages
605
Reaction score
0
Ok, call me a fewl but i'm seriously having the most annoying morning today.

How to you move to the first record in a recordset with PHP and mySQL?!?

Basicaly ive got this:

Code:
$table = mysql_query("SELECT * FROM timages ORDER by date DESC LIMIT 0,6");

while ($record = @mysql_fetch_array($table)){
    echo("whatever");
};

while ($record = @mysql_fetch_array($table)){
    echo("whatever");
};

Obviously in between those two while loops I need to reset the recordset back to the begining.... BUT HOW THE HELL DO I DO IT!! :flame:

It's surely the simplest thing but google is being a tard today or im searching for the wrong thing :(
 
PHP:
	include "config.php";
	$query = "SELECT * FROM timages ORDER by date LIMIT 0,6";
	$result = mysql_query($query) or die(mysql_error());
	
	while ($row = mysql_fetch_object($result)){
		echo 'First loop[br]';
		echo $row->Name.'[br]';
	};
	echo '[br]';
	mysql_data_seek($result,0);
	while ($row = mysql_fetch_object($result)){
		echo 'Second loop[br]';
		echo $row->Name.'[br]';
	};
 
Back
Top