Jump to content

[SOLVED] help with insert into and select


syntax101

Recommended Posts

im using php but i have a problem with my code

 

$sql = 'INSERT INTO archivedeletedorders (order_num,cust_num,prod_name,order_quantity,order_dates,del_date,discount,del_status,

sizesx,sizesy,mounting,typeofmedia,cropping,pocket,total,pay_status,transaction,order_name,print_type)

      Select * from orders where orders_num= '.$_POST['orders_num']';

    $result = $db->query($sql);

Link to comment
https://forums.phpfreaks.com/topic/84963-solved-help-with-insert-into-and-select/
Share on other sites

this

 

 $sql = 'INSERT INTO archivedeletedorders (order_num,cust_num,prod_name,order_quantity,order_dates,del_date,discount,del_status,
   sizesx,sizesy,mounting,typeofmedia,cropping,pocket,total,pay_status,transaction,order_name,print_type)
      Select * from orders where orders_num= '.$_POST['orders_num']';

 

should of been

$sql = 'INSERT INTO archivedeletedorders (order_num,cust_num,prod_name,order_quantity,order_dates,del_date,discount,del_status,
   sizesx,sizesy,mounting,typeofmedia,cropping,pocket,total,pay_status,transaction,order_name,print_type)
      Select * from orders where orders_num= '.$_POST['orders_num'];

 

there was a extra single quotes at the end!

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.