Page 1 of 1

PHP MYSQL update query not updating fields

Posted: Fri Mar 04, 2011 4:47 pm
by pilot911
I have the following PHP script to update two time/date fields in the database.

When i run this the fields are not updated.

Can anyone see where i m going wrong.

<?php
$con = mysql_connect("localhost","dbname","dbpassword");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}

echo 'Connected successfully';

mysql_select_db("my_db", $con);

mysql_query("UPDATE msm_content SET created = '2011-01-02 00:00:00', modified = '2011-01-01 00:00:00'");

echo 'Query Updated successfully';

mysql_close($con);
?>

Your guidance is much appreciated.

Chris

Re: PHP MYSQL update query not updating fields

Posted: Fri Mar 04, 2011 5:15 pm
by anantha
try echoing mysql_error() and see what error it display after the mysql_query()

Re: PHP MYSQL update query not updating fields

Posted: Mon Mar 07, 2011 1:21 pm
by msmohandg
hi..

make sure your databasde field format is acceptable.. (like datetime or varchar)

or give the error msg which you got..

i ll try to give you a solution..