jim.davidson Posted May 4, 2007 Share Posted May 4, 2007 Here’s my code for updating a record: $received_date = now() $updateSQL = sprintf("UPDATE orders SET destroyed=%s, destroyed_pic=%s, received=%s, received_pic=%s, model_number=%s, serial_number=%s, capacity=%s, confirmation_id=%s WHERE order_id=%s", GetSQLValueString($_POST['destroyed'], "text"), GetSQLValueString($_POST['destroyed_pic'], "text"), GetSQLValueString($_POST['received'], "text"), GetSQLValueString($_POST['received_pic'], "text"), GetSQLValueString($_POST['model_number'], "text"), GetSQLValueString($_POST['serial_number'], "text"), GetSQLValueString($_POST['capacity'], "text"), GetSQLValueString($_POST['confirmation_id'], "text"), GetSQLValueString($_POST['order_id'], "int")); All is fine, works as is. My question is I want to add another field to update (a timestamp field), I’m no sure how GetSQLValueString() works with dates. DO I use the following? GetSQLValueString($received_date,"date"), Quote Link to comment Share on other sites More sharing options...
keeB Posted July 14, 2007 Share Posted July 14, 2007 Don't do that $updatedDate = now(); $destroyed = $_POST["destroyed"]; . . . . $q = "UPDATE orders SET destroyed = '$destroyed', ... "; $result = mysql_query($q); ^ much much much easier to read Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.