hi, i have a shopping cart. in checkout page some sql queries doesn't working. <?php if ($checkout == "yes") { $sql="INSERT INTO header (fullname, address, city, post_code, phone, mobile, payment, remarks, ordate, sessionid) VALUES ('$_POST[fullname]', '$_POST[address]', '$_POST[city]', '$_POST[post_code]', '$_POST[phone]', '$_POST[mobile]', '$_POST[payment]', '$_POST[remarks]', '$_POST[ordate]', '$sessionid')"; $result = mysql_query("SELECT * FROM cart WHERE sessionid='$sessionid'"); $result2 = mysql_query("SELECT orderid FROM header WHERE sessionid='$sessionid' ORDER BY orderid desc"); $sql2="INSERT INTO details (orderid, code, qty, pricer) VALUES ('".$orderid."', '".$code."', '".$qty."', '".$pricer."')"; mysql_query("DELETE FROM cart WHERE sessionid='$sessionid'"); echo "record ok"; if (!mysql_query($sql,$con)) { die('Error: ' . mysql_error()); } mysql_close($con); ?><?php } ?> PHP: the first SQL query is working only (INSERT INTO header). can anybody help me?
in asp code: sqlheader="insert into header (fullname, address, city, post_code, phone, mobile, payment, remarks, ordate, sessionid) VALUES ('"&fullname&"','"&address&"','"&city&"','"&post_code&"','"&phone&"','"&mobile&"','"&payment&"','"&remarks&"','1','"&ordate&"','"&sessionid&"')" con2.execute sqlheader sqlselfromCart="select * from cart where sessionid='"&session.sessionid&"'" set ordersRS=con.execute(sqlselfromcart) sqlselfromheader="select orderid from header where sessionid='"&session.SessionID&"' order by orderid desc" set orderidRS=con2.execute(sqlselfromheader) orderid=orderidRS("orderid") 'response.write(orderid) WHILE NOT ordersRS.EOF code=ordersRS("code") qty=ordersRS("qty") pricer=ordersRS("pricer") sqlInsertIntoDetails="insert into details (orderid,code,qty,pricer) VALUES ('"&orderid&"','"&code&"','"&qty&"','"&pricer&"')" con2.execute sqlInsertIntoDetails response.Write("record ok!")%><br><% ordersRS.MoveNext WEND PHP: