Is this possible? I need to run the result of one sql statement into another..
$result= mysqli_query($dbconn,"Select max(cartid) from cart;");
$row = mysqli_fetch_assoc($result);
$sql1 = "insert into cart(cartid) values('".$row['max(cartid)']."');";
mysqli_query($dbconn,$mysql1);
EDIT:
Added in my sql tables to show a better example of what im trying to do
This is my cart table
Basically I want to transfer the row where cartid = 5 from cart table, into the transaction table where the new transaction id will be = 5. As you can see, the transaction table also has a cartid. Not sure how im going to bring over this cartid and insert into the transaction table as a new row. FYI, in order to get cartid=5 i would like to use
order by cartid desc limit 1 to get the last possible row in the cart table
The new transaction table's row will look something like this.
transactionid outletid nric cartid transactiondate totalbeforediscount totalafterdiscount transactiontime username
5 0 0 5 0 0 0 0 0

$result) to then use it in the second - or - will you be using that data elsewhere as well?