Zoranos Posted March 22, 2012 Share Posted March 22, 2012 Hi, i had today problem with my script. Everything worked well on my localhost(xampp server) and when i uploaded on dedi machine functions with MySQL database stoped working. Problem was with mysql_real_escape_string and i forgot that i must first open connection and then mysql_real_escape_string... But strange thing is that on xampp server i dont need to open connection for mysql_real_escape_string, and everything worked well... is there any solutio to php scripts on xampp worke same as php script on linux apache server? Quote Link to comment https://forums.phpfreaks.com/topic/259507-php-mysql_real_escape_string-and-xampp/ Share on other sites More sharing options...
QuickOldCar Posted March 22, 2012 Share Posted March 22, 2012 The solution is to always open the connection first, then use mysql_real_escape_string() Note: A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned. If link_identifier isn't defined, the last MySQL connection is used. Quote Link to comment https://forums.phpfreaks.com/topic/259507-php-mysql_real_escape_string-and-xampp/#findComment-1330266 Share on other sites More sharing options...
Zoranos Posted March 22, 2012 Author Share Posted March 22, 2012 The solution is to always open the connection first, then use mysql_real_escape_string() Note: A MySQL connection is required before using mysql_real_escape_string() otherwise an error of level E_WARNING is generated, and FALSE is returned. If link_identifier isn't defined, the last MySQL connection is used. yes i know that, but i want to have same problem on xampp but there you can use mysql_real_escape_string without connection... i want to know does enyone have solution for xampp... Quote Link to comment https://forums.phpfreaks.com/topic/259507-php-mysql_real_escape_string-and-xampp/#findComment-1330316 Share on other sites More sharing options...
PFMaBiSmAd Posted March 22, 2012 Share Posted March 22, 2012 You should have php's error_reporting set to E_ALL (or even better a -1) and display_errors set to ON in your master php.ini on your xampp development system so that all the php detected errors will be reported and displayed. As long as you are not using any server specific language extensions or system calls, there will be no difference when you run your php script between servers that have the same php.ini configuration and installed extensions. It's highly unlikely your code is working the way you think it is on your xampp system without a mysql connection. You either do have a connection or your code isn't actually using the output from the mysql_real_escape_string statements. Posting your code (less any database credentials) would be the quickest way of both determining what it is doing or not doing both on your development system and the live server. Quote Link to comment https://forums.phpfreaks.com/topic/259507-php-mysql_real_escape_string-and-xampp/#findComment-1330319 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.