#1
  1. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2000
    Location
    Enschede, The Netherlands
    Posts
    1,527
    Rep Power
    16
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Warning: 0 is not a MySQL result index in /home/vacature/public_html/job_view.php3 on line 77[/quote]

    I get this error for the following code. The SELECT result is empty (there are no rows in the table which have hq equal to 'Y'), but I don't think that's the problem. I have a similar query which results in an empty result but there it just returns the print-statement in the else-part of the code. I compared the 2 code's but I can't see any difference
    Anyone nows how to fix this problem?

    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre>
    print( "<table width=100% border=0>" );
    $result_hoofd = mysql_query( "SELECT * FROM provincies WHERE hq='Y'" );
    if ($row_hoofd = mysql_fetch_array($result_hoofd)) { // row 77
    /*print( "<tr>" );
    print( "<td bgcolor=#B1B1B1 width=150><font size=-1 face=arial>Functie</font></td>" );
    print( "<td bgcolor=#B1B1B1><font size=-1 face=arial>Organisatie</font></td>" );
    print( "<td bgcolor=#B1B1B1 width=100><font size=-1 face=arial>Locatie</font></td>" );
    print( "<td bgcolor=#B1B1B1 width=100></td>" );
    print( "</tr>" );
    do {
    print( "<tr>" );
    print( "<td bgcolor=#DDDDDD><font size=-1 face=arial>".$row_hoofd["functie"]."</font></td>" );
    print( "<td bgcolor=#DDDDDD><font size=-1 face=arial>".$row_hoofd["firma"]."</font></td>" );
    print( "<td bgcolor=#DDDDDD><font size=-1 face=arial>".$row_hoofd["plaats"]."</font></td>" );
    print( "<td bgcolor=#DDDDDD><a href="job_vacature.php3?id=".$row_hoofd["id"]."" onMouseOver="window.status='Klik hier voor meer informatie over deze vacature';return true" onMouseOut="window.status='';return true"><font size=-1 face=arial>meer informatie</font></a></td>" );
    print( "</tr>" );
    }
    while( $row_hoofd = mysql_fetch_array( $result_hoofd ) );*/
    }
    else {
    print( "<tr><td bgcolor=#FFFFFF>Momenteel zijn er geen vacatures op het hoofdkantoor.</td></tr>" );
    }
    print( "</table></p>" );

    [/code]

    Mirax
  2. #2
  3. .Net Developer
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2000
    Location
    London
    Posts
    987
    Rep Power
    15

    just check it out wether your field names are correct in your table...

    ---
    test something like this..


    $result_hoofd = mysql_query( "SELECT * FROM provincies WHERE hq='Y'" );


    if (mysql_num_rows($result_hoofd)>0) {
    // record is thier..

    do {
    echo $row_hoofd["functie"];
    }while( $row_hoofd = mysql_fetch_array( $result_hoofd));
    }
    else {
    //no result
    echo "no resultn";
    exit;
    }


    ------------------
    SR -
    webshiju.com

    "The fear of the LORD is the beginning of knowledge..."
  4. #3
  5. Senior Member
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2000
    Location
    Enschede, The Netherlands
    Posts
    1,527
    Rep Power
    16
    Yup, you're right.
    After staring at it for a while and changing a lot of stuff I noticed I swapped two tables, resulting in some wrong fieldnames. Stupid how such an error can keep you occupied for a long time (and another example illustrating you have to keep your eyes open when you re-use some or your other code which uses other values)

    Thnx for the help!!

    Mirax

Similar Threads

  1. Codepupil
    By Adachic in forum C Programming
    Replies: 3
    Last Post: February 6th, 2004, 06:50 PM
  2. syntax error : identifer 'Hole'
    By bootrecker in forum C Programming
    Replies: 2
    Last Post: February 2nd, 2004, 08:08 AM
  3. Replies: 4
    Last Post: January 28th, 2004, 08:29 AM
  4. mysql: getting error description from error code
    By laker in forum PHP Development
    Replies: 1
    Last Post: January 21st, 2004, 06:03 AM
  5. I don't know what this error message means
    By lcham02 in forum Java Help
    Replies: 2
    Last Post: January 13th, 2004, 11:57 AM

IMN logo majestic logo threadwatch logo seochat tools logo