trg86 Posted February 1, 2013 Share Posted February 1, 2013 Okay, I know some of you the past month or so know of the project I am working on right now. I have been pulling my hair out trying to figure out what is causing this issue today. I just got done moving my database from one server (most development) to another server (where it needs to be when its done). Now, the only thing I had to change after the move within my programming was the MySQL login/database info (i.e. username, password, database name, host). But...this is the problem. It no longer wants to insert the data from the form into the database, it's pretty much like it is not firing, even though it works fine on the other server. Does anybody have any suggestions on what could be causing this issue? Thanks ahead of time!! Quote Link to comment https://forums.phpfreaks.com/topic/273891-what-could-this-issue-be/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 1, 2013 Share Posted February 1, 2013 You need to debug exactly where your code and data are doing what you expect and exactly at what point they are not to pin down the problem. Is the form submitting the expected $_POST data? Is the code where the query at even being executed? Is the query producing an error when it runs? Is the page blank (and if it is, what does the 'view source' in the browser show)? Are there any php detected errors in the error log? Do you have php's error_reporting set to E_ALL and display_errors set to ON or log_errors set to ON, so that all the php detected errors will be reported and displayed/logged? Quote Link to comment https://forums.phpfreaks.com/topic/273891-what-could-this-issue-be/#findComment-1409418 Share on other sites More sharing options...
trg86 Posted February 2, 2013 Author Share Posted February 2, 2013 Thanks for your reply. As I said in my original post, everything was working fine for the entire development process so far, until I moved it to the new server. All I changed within my programming, after the server move, was the connection info to the new database, none of my other programming was changed/moved. There are no errors on the page, it still sends the $_POST data to my e-mail inbox and still loads the success page after submission, it just doesn't want to post to the new database for some reason...I can't seem to figure this out. Quote Link to comment https://forums.phpfreaks.com/topic/273891-what-could-this-issue-be/#findComment-1409650 Share on other sites More sharing options...
DavidAM Posted February 2, 2013 Share Posted February 2, 2013 Are you certain the username and password are valid for the server? Does the user have INSERT/UPDATE/DELETE/SELECT Privileges in the database? ... for the tables? You need to echo or log the mysql_error() message if the connection fails, or a query fails. It will tell you why it failed. Quote Link to comment https://forums.phpfreaks.com/topic/273891-what-could-this-issue-be/#findComment-1409657 Share on other sites More sharing options...
trg86 Posted February 2, 2013 Author Share Posted February 2, 2013 (edited) Thanks for the reply David. Yes, I am positive that the username and password are correct, after-all, I still login to phpMyAdmin successfully, which is the same username and password. My account has full privileges, that is definitely not the issue. I am using echo mysql_error() but I am not getting any error messages. Additionally, I also have error_reporting(E_ALL); ini_set("display_errors", 1); in use. Edited February 2, 2013 by trg86 Quote Link to comment https://forums.phpfreaks.com/topic/273891-what-could-this-issue-be/#findComment-1409659 Share on other sites More sharing options...
Psycho Posted February 2, 2013 Share Posted February 2, 2013 Debugging is not hard - you just need to determine where the different conditions/branches are in the logic and then TEST before and after the condition to see what is actually happening. You say that the code has not changed, you are not getting any errors, and everything is working except for the data not getting in the database. If you are checking for errors and none are occurring there are two possible conclusions that I can think of: 1. Your script is inserting records into a different database/table than you think it is. 2. The code to do the insertion is not getting executed because of same conditions/logic in the code So, it is simple to check to see if the insert query is being executed at all. just find where you have the insert query and create a couple of echo statements to validate $query = "INSERT INTO table (fiel1, field2, field3) VALUES ('$value1', '$value2', '$value3')"; echo "Executing query: $query<br>"; $result = mysql_query($query); if(!$result) { echo "Error: " . mysql_error(); } else { echo "Successfully inserted " . mysql_affected_rows() . " records"; } Either you will see that text on the page and will know for certain what is happening or you won't see anything - which means that code is not getting executed and you need to look at your branching logic. Quote Link to comment https://forums.phpfreaks.com/topic/273891-what-could-this-issue-be/#findComment-1409672 Share on other sites More sharing options...
trg86 Posted February 3, 2013 Author Share Posted February 3, 2013 (edited) Psycho, Thank you very much for the reply, I looked at your example code for debugging and wrote it into mine, for testing purposes. I am beginning to think it is not being executed for some reason, as I am still receiving the data in it's e-mail form and being re-directed to the success page, basically, I am not getting any different result than I was before. Would it be helpful if I post more of my code? Is there anything specific you want to see? Ugh, this is one of those annoying glitches, mainly because nothing was changed besides the database info for the new server...it's really odd to me how it could just stop working after working flawlessly on a different server...mind boggling I tell you!! Edited February 3, 2013 by trg86 Quote Link to comment https://forums.phpfreaks.com/topic/273891-what-could-this-issue-be/#findComment-1409809 Share on other sites More sharing options...
PFMaBiSmAd Posted February 3, 2013 Share Posted February 3, 2013 and being re-directed to the success page That implies that php's output_buffering might be turned on in your php.ini, which would discard any status or error messages being outputting on the page. You can check the output_buffering setting by using a phpinfo statement on a page. If output_buffering is turned on, you should turn it off because all it does it hide problems and waste computer resources and human time. Quote Link to comment https://forums.phpfreaks.com/topic/273891-what-could-this-issue-be/#findComment-1409836 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.