Save date in db using mysql in php -


i trying save date in mysql db in php, couldnt figure problem out

code is:

$effectivedate = strtotime("+1 hours", strtotime($time)); $new_date = date("y-m-d h:i:s",$effectivedate); mysql_query('update table set date=$new_date id='.$row['id']); 

but date never changes

whats problem?

you need quotes around date:

mysql_query('update table set date="$new_date" id='.$row['id']) or die(mysql_error()); 

Comments

Popular posts from this blog

Java 8 + Maven Javadoc plugin: Error fetching URL -

android - How to delete or change the searchview icon inside the SearchView actionBar? -

c++ - Msgpack packing bools bug -