Jump to content

Archived

This topic is now archived and is closed to further replies.

markspec87

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

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.)

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites
[!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: parse error, unexpected '{' in /home/terraarm/public_html/index.php on line 106[/quote]

:(

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×

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.