Jump to content

[SOLVED] mysql error im tottally baffeled here :S


jamesxg1

Recommended Posts

if (isset($_POST['Update'])) {
$whoto = mysql_real_escape_string(stripslashes($_POST['whoto']));

$date = mysql_real_escape_string(stripslashes($_POST['fromdate']));

$date = date('Y-m-d',strtotime("$date"));

$sql = sprintf("UPDATE `unlock` SET whoto = '$whoto', when = '$date'") or die(mysql_error());
$query = mysql_query($sql) or die(mysql_error());

print 'Image Sucessfully Updated.';
}

 

 

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 'when = '2009-04-19'' at line 1

you're using sprintf() incorrectly.

 

if (isset($_POST['Update']))
{
$whoto = mysql_real_escape_string(stripslashes($_POST['whoto']));
$date = mysql_real_escape_string(stripslashes($_POST['fromdate']));
$date = date('Y-m-d',strtotime($date));

$sql = sprintf("UPDATE `unlock` SET whoto='%s', when='%s'", $whoto, $date);
$query = mysql_query($sql) or die(mysql_error());

print 'Image Sucessfully Updated.';
}
else
{ echo "Update button not pushed / set."; }

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.