Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: MYSQL error

  1. #1
    ggp
    ggp is offline
    New Coder
    Join Date
    Nov 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts

    MYSQL error

    Hi.

    I am getting this error. Could you help plzz? thanks

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Program Files\Online Services\Apache2\htdocs\searchexample1.php on line 49

    line49: while ($row = mysql_fetch_array($result))


    [HTML]
    [/PHP]


    <?php

    $sql = ("SELECT * FROM ..... WHERE .....");

    $conn = mysql_connect("","") OR DIE (mysql_error());
    mysql_select_db("cartonlots", $conn) OR DIE (mysql_error());

    $result = mysql_query ($sql, $conn);
    echo "<TABLE BORDER=2>";

    while ($row = mysql_fetch_array($result))
    {
    echo "<TR><TD>".$row["image_id"]."<TD>".$row["smdescription"]; }

    echo "</TABLE>";
    ?>


    [/PHP]
    [/HTML]

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Check your query to see if it failed and if it did print mysql_error().

  • #3
    ggp
    ggp is offline
    New Coder
    Join Date
    Nov 2006
    Posts
    25
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Is not error there sorry it says warning.

  • #4
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Your query is failing but you didn't bother to check to see if it is failing, you're just going right in to trying to use the query's resource, which isn't a valid resource, because the query failed, so you are getting a warning about the resource not being valid, which is being caused by your query failing, which you are not checking on.


  •  

    Posting Permissions

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