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 9 of 9
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    31
    Thanks
    4
    Thanked 4 Times in 4 Posts

    mysql_fetch_assoc warning after upgrading from PHP 5.29 to 5.30

    I have been using the codes below under PHP v5.29 without any errors.
    PHP Code:
    $SQL "SELECT * FROM (users,admin) WHERE users.ref=$ref & admin.ref=$ref";
    $result mysql_query($SQL);
    $db mysql_fetch_assoc($result); 
    But, after upgrading to v5.30, the following errors occurs :

    Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in D:\www\profile.php on line 9

    Does anyone know what's going on??

  • #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
    Try checking $result to see if it's false before you attempt to use it (which you should already be doing to catch query failures).

  • #3
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    Yep. By the sounds of it you have an error in your query
    echo SQL to see if the query looks wrong. also echo out mysql_error() in case it's a connection/db selection fault
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Does SQL like bitwise and to separate two conditions within a where clause?
    Methinks this query has never worked, and you're new version of PHP has been set to display errors while you're previous had not been.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #5
    New Coder
    Join Date
    Aug 2009
    Posts
    31
    Thanks
    4
    Thanked 4 Times in 4 Posts
    Nevermind~ just realised that I didn't set the short open tag on after the upgrade and that is causing the problems...

  • #6
    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
    Quote Originally Posted by starvos View Post
    Nevermind~ just realised that I didn't set the short open tag on after the upgrade and that is causing the problems...
    Even so, you should still be checking your queries for errors

  • #7
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by starvos View Post
    Nevermind~ just realised that I didn't set the short open tag on after the upgrade and that is causing the problems...
    I'm not sure how that can be actually causing this issue though. Clearly the error is a PHP one which would indicate that PHP is being properly parsed. Obviously short_open_tags will cause problems, but in this case that does not appear to be the issue
    Unless of course the code is technically different than what has been posted here?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 

  • #8
    Regular Coder
    Join Date
    Dec 2009
    Location
    UK
    Posts
    495
    Thanks
    0
    Thanked 58 Times in 58 Posts
    db connection data could be in short tags I guess, and that wasn't parsed, so no connection and no result is returned?
    My site: JayGilford.com
    Resources:
    PHP Pagination Class | Getting all page links | Handling PHP Errors properly
    If you like a users help, show your appreciation with the rep and thanks buttons :)

  • #9
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,987
    Thanks
    4
    Thanked 2,660 Times in 2,629 Posts
    Quote Originally Posted by JAY6390 View Post
    db connection data could be in short tags I guess, and that wasn't parsed, so no connection and no result is returned?
    Good call on that one!
    Fumigator is still right though, should always have a check of some sorts. Still not 100% certain about that bitwise handling, but when I attempt to throw it at an SQLServer it don't like it too much. I would presume that MySQL is not alright with it too. Access takes it though, but doesn't do anything with it; appears it doesn't support bitwise.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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