Agtronic Posted December 31, 2007 Share Posted December 31, 2007 Hi guys and gals, I'll start out by stating that I'm a newb with PHP, but can get around okay. Throughout all of my searches for specific problems, I have always seen this forum pop up in search results, and usually, I found a solution by reading old threads. Today however, I don't even know what to search for. I'm having a problem with a script I'm working on. Basically, it's a registration form for a dating site, and it is devided into 4 steps. All of the steps are held in one php script, and the proper page is displayed at the correct time. In order to "remember" the data from the previous pages, I register all of the form variables as session variables. Once all 4 pages are filled out, the script then inserts all of the data into a mysql table. The problem I'm having, is that once in a while, someone will create an account, and it will register into the database, but there is only TWO pieces of information that make it in. Everything else is blank. I don't get it. It's as if every session variable was unset before insertion, except for 2. It's really got me stumped. I has happened to a few people, from different computers. I don't even know where to start looking. :S Any help or direction would be greatly appreciated! Thanks so much for your time! Quote Link to comment https://forums.phpfreaks.com/topic/83861-solved-intermittent-problem-with-inserting-data-into-mysql-table/ Share on other sites More sharing options...
revraz Posted December 31, 2007 Share Posted December 31, 2007 Sounds like maybe your variables are getting overwritten, but without any code, it's hard to say. Quote Link to comment https://forums.phpfreaks.com/topic/83861-solved-intermittent-problem-with-inserting-data-into-mysql-table/#findComment-426788 Share on other sites More sharing options...
Agtronic Posted December 31, 2007 Author Share Posted December 31, 2007 Sounds like maybe your variables are getting overwritten, but without any code, it's hard to say. It sure does look that way, but by going over my script over and over, it would seem impossible for that to happen. Really strange. Thanks for your help! Quote Link to comment https://forums.phpfreaks.com/topic/83861-solved-intermittent-problem-with-inserting-data-into-mysql-table/#findComment-426792 Share on other sites More sharing options...
Agtronic Posted January 1, 2008 Author Share Posted January 1, 2008 I figured out the problem. One of the many fields was education, and two of the options were "Master's" and "Bachelor's", both of which contain a single quote. The script never crashed for me, because I never selected either of those in testing. Good thing my Girlfriend is good at testing scripts! Hehehe! A simple addslash() on each of the variables before insertion fixed the problem. I have gotten into the habit of writing code in an magicquotes environment. So incase anyone is looking at this in the future, always clean/filter your data! Thanks guys! Quote Link to comment https://forums.phpfreaks.com/topic/83861-solved-intermittent-problem-with-inserting-data-into-mysql-table/#findComment-427421 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.