Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

little problem with error messages

FirestormFirestorm Member Posts: 162
[b][red]This message was edited by Firestorm at 2002-8-2 3:30:21[/red][/b][hr]
this is my simple code:
[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



MySQL - DB_Zugriff



<?
//verbindung herstellen
$db = mysql_connect();
//Abfrage in Variable schreiben
$result = mysql_db_query("mylab","select * from books");
//Anzahl der Reihen ermitteln
$rows = mysql_num_rows($result);
echo "$rows Datenstze gefunden";
////////////////////////////////
//Schleife mit Anzahl der Reihen laufen lassen
for ($i = 0; $i <= $rows; $i++)
{
$title = mysql_result($result, $i, "title");
$lang = mysql_result($result, $i, "lang");
$rating = mysql_result($result, $i, "rating");
$date = mysql_result($result, $i, "date");
$size = mysql_result($result, $i, "size");
$pages = mysql_result($result, $i, "pages");
$description = mysql_result($result, $i, "description");
//ausgeben
echo "$title, $lang, $rating, $date, $size, $pages, $description";
}
mysql_close($db);
?>


[/code]

well it does everything right so far
I see 1 at first echo
and I see all the data expected on the second echo

but the there come 7 warnings:
Warning: Unable to jump to row 1 on MySQL result index 2 in C:wampp2039mywebdb.php on line 21

Warning: Unable to jump to row 1 on MySQL result index 2 in C:wampp2039mywebdb.php on line 22

Warning: Unable to jump to row 1 on MySQL result index 2 in C:wampp2039mywebdb.php on line 23

Warning: Unable to jump to row 1 on MySQL result index 2 in C:wampp2039mywebdb.php on line 24

Warning: Unable to jump to row 1 on MySQL result index 2 in C:wampp2039mywebdb.php on line 25

Warning: Unable to jump to row 1 on MySQL result index 2 in C:wampp2039mywebdb.php on line 26

Warning: Unable to jump to row 1 on MySQL result index 2 in C:wampp2039mywebdb.php on line 27
, , , , , ,

[red]WHY??[/red]
by the way the lines 21 to 27 are the first 7 lines of the for loop


Firestorm
fgretz@gmx.de
;-)


Comments

  • FirestormFirestorm Member Posts: 162
    I got it:
    the error was in the for-statement
    [code]
    for ($i=0;$i[red]<[/red]$rows;$i++)
    [/code]
    Firestorm
    fgretz@gmx.de
    ;-)

  • Chris BrownChris Brown USAMember Posts: 4,496 ✭✭

    _____ || http://forcoder.org || free ebooks and video tutorials about { R Scratch JavaScript Perl C++ PL/SQL Python Visual Basic .NET Assembly MATLAB Go Delphi C Objective-C Swift Java Ruby C# PHP Visual Basic ML Lua COBOL Prolog Alice Scala Kotlin Fortran Julia Logo FoxPro D Apex VBScript Crystal LabVIEW Awk Bash F# Scheme SAS Clojure Rust Hack Dart ABAP Erlang Ada Transact-SQL Lisp } ______________

Sign In or Register to comment.