flashbangpro Posted August 28, 2012 Author Share Posted August 28, 2012 Seriously at this point I'm starting to think you're trolling. You set the fields to blank values. Of course they are blank. What did you expect? I realize you may not want to help me anymore and I understand I can be frustrating not knowing all that you know, Thank you for the help you have given. Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373222 Share on other sites More sharing options...
flashbangpro Posted August 28, 2012 Author Share Posted August 28, 2012 I have just realized that the INSERT clause apparently doesn't take a WHERE so I have switched back to UPDATE and this is the error I recieved You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5 Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5 SQL: UPDATE service_info SET `date_next_maint`='testing', `date_reported`='testing', `scheduled_service_date`='testing', `service_performed`='', `date_service_performed`='testing', `date_of_followup`='',`service_in_progress`='', `date_return_use`='', `time_return_use`='', `issues_nonrepairable`='', `date_nonrepairable_issues`='', `comments` ='' WHERE id= Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373223 Share on other sites More sharing options...
flashbangpro Posted August 28, 2012 Author Share Posted August 28, 2012 Ok I had forgot my single quotes on WHERE id='$id' "; So now I have no errors, but the data hasn't been updated either. Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373233 Share on other sites More sharing options...
PFMaBiSmAd Posted August 28, 2012 Share Posted August 28, 2012 The single-quotes you just added didn't fix anything. They are hiding the fact that $id is empty in the query. You shouldn't have quotes around numerical data values inside of a query anyway. You still must find out why the $id variable doesn't have a value in it (you shouldn't even be running the query if there's no $id.) Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373242 Share on other sites More sharing options...
flashbangpro Posted August 28, 2012 Author Share Posted August 28, 2012 The maint_update page url shows that it is pulling the correct id from the service_list_update page. I don't understand how there is no $id Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373244 Share on other sites More sharing options...
PFMaBiSmAd Posted August 28, 2012 Share Posted August 28, 2012 You have put the error_reporting/display_errors settings at the end of your code. How could that help with errors that occur when your code runs? Those two settings would need to be put before the session_start() statement. You should actually have those two values set in your master php.ini so that you don't need to put them into your code and you don't need to remember to remove them when you put your code onto a live server. Having them in your master php.ini will also report and display fatal parse/syntax errors in your main file. Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373248 Share on other sites More sharing options...
flashbangpro Posted August 28, 2012 Author Share Posted August 28, 2012 Ok I will move them above session start and added print $query and this is what I got.... Notice: Undefined index: id in /data/9/0/28/4/517493/user/528148/htdocs/jednewdb/updated_maint.php on line 9 Notice: Undefined index: service_in_progress in /data/9/0/28/4/517493/user/528148/htdocs/jednewdb/updated_maint.php on line 16 UPDATE service_info SET `date_next_maint`='8/23/12', `date_reported`='8/20/12', `scheduled_service_date`='8/20/12', `service_performed`='', `date_service_performed`='8/20/12', `date_of_followup`='',`service_in_progress`='', `date_return_use`='8/24/12', `time_return_use`='23:00', `issues_nonrepairable`='', `date_nonrepairable_issues`='testing', `comments` ='' WHERE id='' I don't understand how it isn't defined when it is the correct id on the maint_update page Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373278 Share on other sites More sharing options...
PFMaBiSmAd Posted August 28, 2012 Share Posted August 28, 2012 I don't see a session_start() statement on the maint_update page. So no $_SESSION variable you set there will exist outside of that page. Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373280 Share on other sites More sharing options...
flashbangpro Posted August 28, 2012 Author Share Posted August 28, 2012 Thank you, that is what I was missing, Is there a way to mark this as resolved? Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373283 Share on other sites More sharing options...
PFMaBiSmAd Posted August 28, 2012 Share Posted August 28, 2012 There's a green solved button at the lower-left on the page. Quote Link to comment https://forums.phpfreaks.com/topic/267643-help-updating-mysql-database-tables/page/3/#findComment-1373286 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.