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? Link to comment https://forums.phpfreaks.com/topic/49877-solved-date-formating-problem/ Share on other sites More sharing options...
Wildbug Posted May 3, 2007 Share Posted May 3, 2007 sprintf and DATE_FORMAT use similar "placeholders." You need to escape those in DATE_FORMAT because sprintf is interpreting them. Use '%%b %%e, %%y'. Link to comment https://forums.phpfreaks.com/topic/49877-solved-date-formating-problem/#findComment-244715 Share on other sites More sharing options...
Wildbug Posted May 3, 2007 Share Posted May 3, 2007 And there's no need to triple post. Link to comment https://forums.phpfreaks.com/topic/49877-solved-date-formating-problem/#findComment-244744 Share on other sites More sharing options...
jim.davidson Posted May 4, 2007 Author Share Posted May 4, 2007 Thanks for the help. Sorry about the triple post, but I wasn't sure if it was a PHP , MySQL, or a Dreamweaver problem. won't happen again. Again thanks that solved the problem Link to comment https://forums.phpfreaks.com/topic/49877-solved-date-formating-problem/#findComment-245345 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.