Code: Select all
if ($result) {
$data = "SELECT itemId, qty, price, cartId FROM cart ";
$result1 = @mysql_query($data) or die (mysql_error());
if ($row = mysql_fetch_array($result1)) {
$itemId = $rowї'itemId'];
$qty = $rowї'qty'];
$price = $rowї'price'];
$cartId = $rowї'cartId'];
$query1 = "INSERT INTO view (itemId, price, qty, cartId) VALUES ('$itemId','$price','$qty','$cartId' )";
$result2 = mysql_query($query1) or die(mysql_error());// Run the query.
if ($result2) {
$insert = "UPDATE view SET account_no = '$aa', token_id = '$t', name = '$n', address = '$ad', state = '$s', country = '$c' WHERE cartId = '$cartId'";
$result_insert = mysql_query ($insert) or die(mysql_error());
} else {
echo '<p><font color="red" size="+1">Cannot update to the database</font></p>';
}
// Successful add the new customer.
echo '<h3>Successful the transaction</h3>';
include ('includes/header_bank.html');
exit();
} else {
echo '<p><font color="red" size="+1">Unsucessful transaction</font></p>';
}
} else { // The account number does not match with token ID.
echo '<p><font color="red" size="+1">The account number does not match with the reference ID in the database</font></p>';
}in my cart table it has 2 data but when I want to insert the cart table to view table it just appear 1 data... it does not insert all the data. Can you please help me in the sql queries to solve my problem? I really appreciated your help.