DataRater Posted November 25, 2009 Share Posted November 25, 2009 PHP 5 Please Help. This code is putting ':' into $Value so the mysql_errno and mysql_error are not return anything even though $ResultSet is false. Can you tell me why? The value of $SQL is UPDATE conversion_rate SET rate='1.79743838' WHERE currency='AUD' which is fine. I have executed this in my MYSQL client and it works. $GBPAUD = $this->GetExchangeRate('GBP','AUD'); $SQL=sprintf("UPDATE conversion_rate SET rate='%s' WHERE currency='AUD'", $GBPAUD ); $ResultSet = @mysql_query($SQL,$MySQLConnection); if ($ResultSet == false){ $Value=mysql_errno($MySQLConnection) . ": " . mysql_error($MySQLConnection); } else { $Value='True'; } Quote Link to comment https://forums.phpfreaks.com/topic/182917-im-executing-an-update-and-doesnt-work-in-php/ Share on other sites More sharing options...
cags Posted November 25, 2009 Share Posted November 25, 2009 Try changing... $ResultSet = @mysql_query($SQL,$MySQLConnection); to $ResultSet = mysql_query($SQL,$MySQLConnection) or trigger_error("SQL: $SQL, ERROR: " . mysql_error(), E_USER_ERROR); Quote Link to comment https://forums.phpfreaks.com/topic/182917-im-executing-an-update-and-doesnt-work-in-php/#findComment-965455 Share on other sites More sharing options...
PFMaBiSmAd Posted November 25, 2009 Share Posted November 25, 2009 mysql_errno and mysql_error are not return anything ... Can you tell me why? Probably because the mysql extension is not enabled. Remove the @ from in front of the mysql_query() (there is no reason to ever put an @ in any code, you want to see all errors during development and testing and on a live server you would have display_errors turned off anyway) and for debugging add the following two lines of code immediately after your first opening <?php tag - ini_set("display_errors", "1"); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/182917-im-executing-an-update-and-doesnt-work-in-php/#findComment-965463 Share on other sites More sharing options...
DataRater Posted November 25, 2009 Author Share Posted November 25, 2009 Thanks Cags. I got it to work. Stephen :-) Quote Link to comment https://forums.phpfreaks.com/topic/182917-im-executing-an-update-and-doesnt-work-in-php/#findComment-965464 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.