mysql_seek_data not working

admin

Administrator
Staff member
As subject says, I can't get the mysql_seek_data function to work.

I've been attempting to make a MySQL and PHP driven Guest-book, but have fallen flat on my face with this particular problem. I can get the script working fine with PostgreSQL (obviously using - pg_fetch_row($result, $row_number), but as you know, MySQL doesn't allow me to do this (bah!). So I went ahead and used the mysql_seek_data function, but it doesn抰 work. Instead all my script does is output the most recent addition in the database, over and over. I've probably missed something so obviously stupid that I'll be cursing myself for the next week or so, but at the moment this is really, really beginning to bug me. So umm? Help!

Code -

for ($i = $a; $i < ($a + 5); $i++) {

@mysql_data_seek($result, $i);
$resultArray = @mysql_fetch_row($result);

if ($resultArray) {

$vars = unserialize($resultArray[2]);
$vars = array_values($vars);

$resultArray[1] = substr($resultArray[1], 0, 10);
$datepieces = explode("-", $resultArray[1]);
$unixtime = mktime(0,0,0,$datepieces[1],$datepieces[2],$datepieces[0]);

$template = str_replace("<date>", date("l F jS Y", $unixtime), $template);
$footer = str_replace("<pagenumber>", $pagenumber, $footer);

for ($t = 0; $t < sizeof($vars); $t++) {
$vars[$t] = str_replace(chr(13), "", $vars[$t]);
$vars[$t] = str_replace(chr(10), "<br>", $vars[$t]);
$template = str_replace("<field$t>", $vars[$t], $template);
}

echo $template;

}
}
 
Back
Top