Its on 2 separate PHP pages now as follows:-
//Create a new Order record
$newOrder = \"INSERT INTO ORDERS (CUSTID, STATUS) VALUES ($cust_id, 0) \";
$saveOrder = mysql_query($newOrder);
The above is run when the user confirms a shopping basket. This works ok. They then fill out some shipping details and then confirms these by clicking a form button. This then runs this page:-
//Get newly created ORDERID from ORDERS table
//PROBLEM AT THIS STAGE
$getOrdid = \"SELECT LAST_INSERT_ID() FROM ORDERS WHERE CUSTID=$cust_id AND STATUS=0 \";
$confOrdid = mysql_query($getOrdid);
echo($getOrdid);
echo($confOrdid);
Iv\'e tried both last_insert_id() and simply ORDERID (as stated in the ORDERS table) but when $confOrdid is echoed it always displays 2 for the orderid for every order created. Ive listed the table structure below if this helps at all?
\"CREATE TABLE ORDERS (
ORDERID INT NOT NULL AUTO_INCREMENT PRIMARY KEY,
CUSTID INT NOT NULL,
PROCESSED TIMESTAMP,
STATUS INT,
SHIPPED DATETIME
)\";
Thanks.