surajkandukuri Posted November 6, 2009 Share Posted November 6, 2009 Hi, I have a sql UPDATE query $update_query="update employee_positionheld SET `Position held 2`='$tempjobname' and `Start Date 2`='$startdate' where `EmployeeNumber`='$employeenumber'"; echo($update_query); echo("<br>"); mysql_query($update_query) or die("updation failed"); update_query prints :- update employee_positionheld SET `Position held 2`='Process Tech 1' and `Start Date2`='2009-11-05' where `EmployeeNumber`='34550' WHICH IS CORRECT as per my variables BUT in the database Position held 2=0 and Start Date 2=0 I do not know what is happening here, please suggest me ... Link to comment https://forums.phpfreaks.com/topic/180492-unable-to-insert-values-into-database/ Share on other sites More sharing options...
rajivgonsalves Posted November 6, 2009 Share Posted November 6, 2009 are those your field names ? instead of mysql_query($update_query) or die("updation failed"); try mysql_query($update_query) or die(mysql_error()); maybe it will help Link to comment https://forums.phpfreaks.com/topic/180492-unable-to-insert-values-into-database/#findComment-952177 Share on other sites More sharing options...
JJ2K Posted November 6, 2009 Share Posted November 6, 2009 Are the data types of the fields correct? They look like they could be set to an INT when they should be String/Date Time Link to comment https://forums.phpfreaks.com/topic/180492-unable-to-insert-values-into-database/#findComment-952181 Share on other sites More sharing options...
surajkandukuri Posted November 6, 2009 Author Share Posted November 6, 2009 I checked the data types they are VARCHAR(Position held) and DATE(Start Date) Link to comment https://forums.phpfreaks.com/topic/180492-unable-to-insert-values-into-database/#findComment-952190 Share on other sites More sharing options...
JJ2K Posted November 6, 2009 Share Posted November 6, 2009 Try removing the single quotes from around the variables. I also notice in some instances you are reffering to the date field as: Start Date 2 and other times as: Start Date2 w/ or w/o a space make sure it's correct. Link to comment https://forums.phpfreaks.com/topic/180492-unable-to-insert-values-into-database/#findComment-952200 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.