Advanced Search

Results 1 to 3 of 3

Thread: mysql error not valid

  1. #1
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default mysql error not valid

    Hi Believe it or not I am quite new to working with these errors and need a little help I have got the error message below and do not know how to fix it. I have got basically the same error message on 11 different lines but the message is the same. I ave showed just a couple of the errors as the only difference is the line number.

    Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/content/07/7560507/html/hits/prepend.inc.php on line 15

    Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/content/07/7560507/html/hits/prepend.inc.php on line 19

    Not sure if I should include all the code if I need to just say and I will but here is the code for the above lines.

    $result77 = mysql_query("SELECT startseite FROM `demo_a_texte`");
    $myrow77 = mysql_fetch_row($result77);
    $starttext = $myrow77[0];

    $result12 = mysql_query("SELECT aa, ab, ba, bb, ca, cb, da, db FROM `demo_a_grosse`");
    $myrow12 = mysql_fetch_row($result12);

    $einsa = $myrow12[0];
    $einsb = $myrow12[1];
    $zweia = $myrow12[2];
    $zweib = $myrow12[3];
    $dreia = $myrow12[4];
    $dreib = $myrow12[5];
    $viera = $myrow12[6];
    $vierb = $myrow12[7];

    ..........................................................................
    If some one can see an obvious error in the above code please let me know
    Best regards

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,154
    Thanks
    260
    Thanked 690 Times in 678 Posts

    Default

    There's nothing wrong with the format of your MySQL code.

    The problem must be in how you are referring to your database structure. For example, maybe the columns don't exist. Check all of that again and see if it all matches up. Basically it's failing because you told it to find something that it can't find, not because you told it to find it using the wrong words.

    One recommendation I have is to use named indices rather than numbers. Something like this:
    PHP Code:
    $result12 mysql_query("SELECT * FROM `demo_a_grosse`");
    $myrow12 mysql_fetch_row($result12);

    $einsa $myrow12['aa'];
    $einsb $myrow12['ab'];
    $zweia $myrow12['ba'];
    $zweib $myrow12['bb'];
    $dreia $myrow12['ca']; 
    Note that this way you don't need to specify which items you want to extract from the database. It's still possible to do that (just list all of them by name that you will want later instead of the * that means everything), but it's usually not needed if you're taking out a lot of them. If you're taking out only a few columns then that method is good; otherwise it's just too much to type.

    (If you really have aa-ab-ba-bb-......-zz, then that might be enough that it's worth specifying them individually. I'm guessing this is just an example though.)
    Daniel - Freelance Web Design | <?php?> | <html>| espa˝ol | Deutsch | italiano | portuguŕs | catalÓ | un peu de franšais | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Nov 2011
    Posts
    7
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for your answer. I started to go over everything again like you said (but not till this morning, my head was buzzing yesterday) To much code gives headaches
    I hate to say it BUT I had failed to upload my database to the correct place so it was searching for a database that did not exist I have since uploaded it to the correct place and all my headaches went away.
    Thanks for your quick answer and I dare say I will be back as I am still very much on a learning curve
    Best regards Nige.

    edit
    and yes aa-ab all that was genuine code I would never ask for help and make code up

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •