jim.davidson Posted May 3, 2007 Share Posted May 3, 2007 I run this code and everything is OK $query_getOrder = sprintf("SELECT orders.customer_id, orders.order_date, orders.received_date, orders.updated_date, orders.received_by, orders.destroyed_by, orders.model_number, orders.serial_number, orders.capacity, orders.confirmation_id, customers.contact_name, customers.contact_phone, manufacturers.manufacture_name FROM orders LEFT JOIN customers ON orders.customer_id = customers.customer_id LEFT JOIN manufacturers ON orders.manufacturer_id = manufacturers.manufacturer_id WHERE orders.confirmation_id = %s", GetSQLValueString($colname_getOrder, "text")); mysql_select_db($database_imcrecycle, $imcrecycle); $getOrder = mysql_query($query_getOrder, $imcrecycle) or die(mysql_error()); $row_getOrder = mysql_fetch_assoc($getOrder); $totalRows_getOrder = mysql_num_rows($getOrder); Tried to format date with this code…. $query_getOrder = sprintf("SELECT orders.customer_id, DATE_FORMAT(orders.order_date, '%b %e, %y') AS order_date, orders.received_date, orders.updated_date, orders.received_by, orders.destroyed_by, orders.model_number, orders.serial_number, orders.capacity, orders.confirmation_id, customers.contact_name, customers.contact_phone, manufacturers.manufacture_name FROM orders LEFT JOIN customers ON orders.customer_id = customers.customer_id LEFT JOIN manufacturers ON orders.manufacturer_id = manufacturers.manufacturer_id WHERE orders.confirmation_id = %s", GetSQLValueString($colname_getOrder, "text")); mysql_select_db($database_imcrecycle, $imcrecycle); $getOrder = mysql_query($query_getOrder, $imcrecycle) or die(mysql_error()); $row_getOrder = mysql_fetch_assoc($getOrder); $totalRows_getOrder = mysql_num_rows($getOrder); I get this error Warning: sprintf() [function.sprintf]: Too few arguments in C:\Sites\recycle_view_order.php on line 104 Query was empty What am I doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/49880-solved-date-formating-problem/ Share on other sites More sharing options...
fenway Posted May 3, 2007 Share Posted May 3, 2007 The % signs in the date format specifier are confusing to the sprintf() function, which uses this to find places to make substitutions -- you'll have to escape the ones that you want treated as literals. Quote Link to comment https://forums.phpfreaks.com/topic/49880-solved-date-formating-problem/#findComment-244724 Share on other sites More sharing options...
jim.davidson Posted May 4, 2007 Author Share Posted May 4, 2007 Thanks and sorry about the triple post but I was not sure if the problem was related to PHP, MySQL, or Dreamweaver. Won't happen again. Thanks again, your answer works. Quote Link to comment https://forums.phpfreaks.com/topic/49880-solved-date-formating-problem/#findComment-245353 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.