syntax101 Posted January 8, 2008 Share Posted January 8, 2008 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 More sharing options...
revraz Posted January 8, 2008 Share Posted January 8, 2008 You sure do. You need to specify VALUES for your INSERT and you need to seperate it from your SELECT Link to comment https://forums.phpfreaks.com/topic/84963-solved-help-with-insert-into-and-select/#findComment-433243 Share on other sites More sharing options...
syntax101 Posted January 8, 2008 Author Share Posted January 8, 2008 i tried to put an sql statement in phpmyadmin that doesnt need a VALUE and it works code: insert into archivedeletedorders select * from orders where orders_num = 1373 Link to comment https://forums.phpfreaks.com/topic/84963-solved-help-with-insert-into-and-select/#findComment-433282 Share on other sites More sharing options...
rajivgonsalves Posted January 8, 2008 Share Posted January 8, 2008 did you try echoing the insert statement in php is $_POST['orders_num'] coming in properly ? Link to comment https://forums.phpfreaks.com/topic/84963-solved-help-with-insert-into-and-select/#findComment-433285 Share on other sites More sharing options...
syntax101 Posted January 8, 2008 Author Share Posted January 8, 2008 yes i did, my editor is dreamweaver and when i type those code the color of the codes turn red so it means it has an error . Link to comment https://forums.phpfreaks.com/topic/84963-solved-help-with-insert-into-and-select/#findComment-433291 Share on other sites More sharing options...
rajivgonsalves Posted January 8, 2008 Share Posted January 8, 2008 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! Link to comment https://forums.phpfreaks.com/topic/84963-solved-help-with-insert-into-and-select/#findComment-433293 Share on other sites More sharing options...
syntax101 Posted January 8, 2008 Author Share Posted January 8, 2008 thanx for the help. i will try this if it will work. Link to comment https://forums.phpfreaks.com/topic/84963-solved-help-with-insert-into-and-select/#findComment-433299 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.