php - cannot insert the right values into table -


i have database named user_job_apply(id, job_id, postby_id, applier_id, flag, flag_wall, time_apply).

the "time_apply" type in database set :datetime

my problem following piece of code inserts suceesfully in databe, not insert value $timestring. when in database shows 0000-00-00 00:00:00. idea problem here?

i have tested echoing $timestring , displays date , time success, cannot pass database. idea how fix this?

<?php  // next 2 values comes form   $the_job_code =  mysql_real_escape_string($_post['jobid']); $the_postedby =  mysql_real_escape_string($_post['postedby']);  // use current time user's computer  $timestring= ' <script language="javascript"> var today = new date(); var dd = today.getdate(); var mm = today.getmonth()+1; //january 0! var yyyy = today.getfullyear();  if(dd<10) {     dd="0"+dd }   if(mm<10) {     mm="0"+mm }   today = mm+"/"+dd+"/"+yyyy + " " +today.gethours() + ":" + today.getminutes()+":" +    today.getseconds(); document.write(today); </script> ';  mysql_query("insert `user_job_apply` values ('', '$the_job_code', '$the_postedby ', '$session_user_id', '1', '1', '$timestring') ");   ?> 

maybe need use mysql date format, 'yyyy-mm-dd'?


Comments

Popular posts from this blog

php - render data via PDO::FETCH_FUNC vs loop -

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

The canvas has been tainted by cross-origin data in chrome only -