Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-17-2013, 02:46 PM   PM User | #1
Remix919
Regular Coder

 
Join Date: Jan 2006
Posts: 193
Thanks: 29
Thanked 0 Times in 0 Posts
Remix919 is an unknown quantity at this point
Issue with Upgrade from 5.2.17 to 5.3.20?

I just recently upgraded to PHP 5.3.20 and now suddenly I'm having issues with my code, with just simple things like mysql_fetch_assoc and mysql_query?

I'm getting issues like:

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given

and when I do a mysql_query INSERT it looks like it works fine, but no entry appears in the database.

All this was working perfectly prior to the upgrade to 5.3.20 from 5.2.17, any idea what's going on?
Remix919 is offline   Reply With Quote
Old 01-17-2013, 03:03 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,650
Thanks: 4
Thanked 2,451 Times in 2,420 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
The upgrade itself wouldn't have changed the functionality of the mysql library. Its likely your configurations that do not work.
The issue is simply that your query has failed and you don't have proper error handling in place. Given that it worked on a previous build and not on the 5.3 build would tell me that its your configurations that have changed in your ini environment. Perhaps you are relying on magic_quotes_gpc or register_globals (both gone as of 5.4; deprecated as of 5.3).
__________________
As of PHP 5.5, the MySQL library has been officially deprecated. It is recommended to move to either MySQLi or PDO libraries for your mysql connectivity. See here for help choosing which interface you prefer: http://php.net/manual/en/mysqlinfo.api.choosing.php
Fou-Lu is offline   Reply With Quote
Old 01-17-2013, 03:51 PM   PM User | #3
Remix919
Regular Coder

 
Join Date: Jan 2006
Posts: 193
Thanks: 29
Thanked 0 Times in 0 Posts
Remix919 is an unknown quantity at this point
The error I get is "MySQL server has gone away", I looked up this issue but seems to be a multitude a reasons, but basically means the query timed out? Is there a setting in the php ini file that would affect this?
Remix919 is offline   Reply With Quote
Old 01-17-2013, 04:01 PM   PM User | #4
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,508
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
It could be many things. I've had the sql server gone away message a few times myself. I can't remember what caused it but I know I had to tinker with a few settings and the code too.

Watch out for date and mktime functions too. I can't remember what but I ran into trouble with both of those when tranferring my code from my 5.3.0 wamp to a linux 5.2.7 setup which gave me a lot of head scratching moments to deal with.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Old 01-17-2013, 04:25 PM   PM User | #5
Remix919
Regular Coder

 
Join Date: Jan 2006
Posts: 193
Thanks: 29
Thanked 0 Times in 0 Posts
Remix919 is an unknown quantity at this point
Figured it out, it was the mysql connect_timeout setting, after all the upgrades and whatnot it apparently got set to 8 seconds, I increased it to 60 and everything works fine now
Remix919 is offline   Reply With Quote
Old 01-17-2013, 05:38 PM   PM User | #6
tangoforce
Senior Coder

 
tangoforce's Avatar
 
Join Date: Feb 2011
Location: Your Monitor
Posts: 3,508
Thanks: 45
Thanked 439 Times in 428 Posts
tangoforce will become famous soon enoughtangoforce will become famous soon enough
Thats still a long time for a mysql connection though.. that must be one busy server!

Actually thinking about it, have you optimised your sql calls so limit them to as few as possible? - if you're running several hundred per script then you can grind a SQL server right down. I'm not saying thats what you're doing but just putting forward an idea just in case.
__________________
Please wrap your code in [php] tags. It is a sticky topic and it HELPS us to HELP YOU!
TIP: Coding styles and $end errors :::::::::: TIP: Warning: Cannot modify header information - headers already sent :::::::::: TIP: Quotes / Parse error: syntax error, unexpected T_..
PHP Code:
//Please don't use this for your form processing:
if (isset($_POST['submit']))
//Internet explorer has a bug and does not always send the submit value. 
Explanation: The IE if(isset($_POST['submit'])) bug explained.
tangoforce is online now   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:52 PM.


Advertisement
Log in to turn off these ads.