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
  1. #1
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post

    Fetch Array not working

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/jsfdan/public_html/forum.php on line 133

    Err, why has that happened. Line 134 code looks fine to me.

    Line 134:
    PHP Code:
    $newest mysql_fetch_array(mysql_query("SELECT * FROM `forum_thread` WHERE `cat_id` = '$topic[id]' ORDER BY `datetwo` DESC LIMIT 0, 1")); 
    Funny thing is, this worked when I was on my old host.
    Last edited by Fou-Lu; 12-02-2008 at 11:48 PM.
    Formerly MysticScript

    6+ years club

  • #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
    Add error checking.

  • #3
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,146
    Thanks
    2
    Thanked 333 Times in 325 Posts
    I'll expand on what Fumigator posted.

    Your code has no application error checking, error reporting (logging), and error recovery logic in it to test if the query worked or not, report (or log) why it did not work, and take appropriate action when it does not work (like don't execute a mysql_fetch_xxxxx() instruction after a query that failed.) So, of the dozen possible reasons why it is not working, we cannot tell you which one, but your program could with some application error checking, error reporting, and error recovery logic.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.

  • Users who have thanked CFMaBiSmAd for this post:

    Fumigator (12-02-2008)

  • #4
    Regular Coder UrbanTwitch's Avatar
    Join Date
    Apr 2006
    Posts
    485
    Thanks
    44
    Thanked 1 Time in 1 Post
    Ah thank you.

    *resolved*
    Formerly MysticScript

    6+ years club


  •  

    Posting Permissions

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