Code: Select all
$query_rs_orderid = sprintf("INSERT INTO order_list (order_by,status,order_date)VALUES('%s',1,now())", $userid);
$rs_orderid = mysql_query($query_rs_orderid, $Conn) or die(mysql_error());
$query_rs_post = sprintf("INSERT INTO order_item (order_id,item_id)VALUES(%s) SELECT itemid FROM cart WHERE orderby=%s", mysql_insert_id(), $userid);i want to inside all the itemid where orderby is = $userid,and the order_id will be the previous sql statement had inserted auto increase id that why i use mysql_insert_id(),the problem is at item_id,shall i use do while loop to insert?or any better solution?