Jump to content

Warning: mysql_result(): Unable to jump to row 1...


markspec87

Recommended Posts

Error:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Warning: mysql_result(): Unable to jump to row 1 on MySQL result index 5 in /home/terraarm/public_html/index.php on line 108[/quote]

Code:

[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]$query="SELECT * FROM news ORDER BY datum DESC LIMIT 1,1";
$result=mysql_query($query);
$num=mysql_numrows($result);

$i=1;

$author2=mysql_result($result,$i,"author");
$text2=mysql_result($result,$i,"text");
$datum2=mysql_result($result,$i,"Datum");
$readmore2=mysql_result($result,$i,"readmore");
$image2=mysql_result($result,$i,"image");
$title2=mysql_result($result,$i,"title");
$summary2=mysql_result($result,$i,"summary");

?>[/quote]


Any ideas whats wrong? (The DB is def setup correctly, i.e the row exists.)
Link to comment
Share on other sites

[code]
$query="SELECT * FROM news ORDER BY datum DESC LIMIT 1,1";
$result=mysql_query($query);

$num=mysql_num_rows($result) {

$i=1;

$author2=mysql_result($result,$i,"author");
$text2=mysql_result($result,$i,"text");
$datum2=mysql_result($result,$i,"Datum");
$readmore2=mysql_result($result,$i,"readmore");
$image2=mysql_result($result,$i,"image");
$title2=mysql_result($result,$i,"title");
$summary2=mysql_result($result,$i,"summary");
}
?>
[/code]
Link to comment
Share on other sites

Don't use the mysql_result() function, use mysql_fetch_assoc() instead:
[code]<?php
$query="SELECT * FROM news ORDER BY datum DESC LIMIT 1,1";
$result=mysql_query($query);
$num=mysql_numrows($result);
$rw = mysql_fetch_assoc($result);
$author2=$rw['author'];
$text2=$rw['text'];
$datum2=$rw['Datum'];
$readmore2=$rw['readmore'];
$image2=$rw['mage'];
$title2=$rw['title'];
$summary2=$rw['summary'];
?>[/code]
Ken
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.