Click to See Complete Forum and Search --> : I'm getting some errors in the guestbook script i wrote...


Sexay_Hamster
11-20-2003, 05:28 PM
its giving me some errors that say:

Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3 in /home/benson1/public_html/sh/guestbook.php on line 47

Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3 in /home/benson1/public_html/sh/guestbook.php on line 48

Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3 in /home/benson1/public_html/sh/guestbook.php on line 50

Warning: mysql_result(): Unable to jump to row 0 on MySQL result index 3 in /home/benson1/public_html/sh/guestbook.php on line 52


its giving me errors with my mysql_result on the following lines.
here is the code:

<?
$query = "SELECT * FROM guestbook ORDER BY date";
$result= mysql_query($query, $connection);

for($i = 0; $i < mysql_num_rows($result); $i++); {

$name = mysql_result($result, $i, "name");
$email = mysql_result($result, $i, "email");
$email_len = strlen($email);
$comment = mysql_result($result, $i, "comment");
$comment = nl2br($comment);
$date = mysql_result($result, $i, "date");
$show_date = date("H:i:s m/d/Y, $date");

does anyone know why?

Khalid Ali
11-20-2003, 05:56 PM
seems like its not pleased with the loop index you are passing in, try using something like this

while($record = mysql_fetch_array($result)){


$name = $record[0];

$email = $record[1];

$email_len = strlen($email);

$comment = $record[2];

}