Hi again, hopefully this will be the last time you guys have to sift through my jumbled code, so thanks for all your support so far 😃
Here's what I'm dealing with this time..
<?php
session_start();
$DBConnect = mysqli_connect("localhost", "root", "qg85eo");
if (!$DBConnect)
die("<p>The XAMPP MySQL database server is not available.</p>");
$DBSelect = mysqli_select_db($DBConnect, "geop");
if (!$DBSelect)
die("<p>Your database is not available.</p>");
if(isset($_POST['checkoutReg'])){
$SQLInsert1 = "insert into customer values('', '".$_SESSION['fname']."', '".$_SESSION['lname']."',
'".$_SESSION['cname']."', '".date('d/m/y')."', '".$_SESSION['address1']."',
'".$_SESSION['address2']."', '".$_SESSION['suburb']."', '".$_SESSION['states']."',
'".$_SESSION['pcode']."', '".$_SESSION['email']."', '".$_SESSION['pword']."')";
$ResultSet1 = mysqli_query($DBConnect, $SQLInsert1);
if (!$ResultSet1)
die("<p>Unable to execute the query.</p>");
$SQLQuery1 = "select max(customerID) from customer";
$ResultSet2 = mysqli_query($DBConnect, $SQLQuery1);
if (!$ResultSet2)
die("<p>Unable to execute the query.</p>");
$Row1 = mysqli_fetch_row($ResultSet2);
$SQLInsert2 = "insert into orderheader values('', '".$Row1[0]."', '".date('d/m/y')."', '".$_SESSION['totalprice']."',
'Home', '".$_SESSION['address1']."', '".$_SESSION['address2']."', '".$_SESSION['suburb']."', '".$_SESSION['states']."',
'".$_SESSION['pcode']."', '".$_POST['comment']."', '".$_POST['shipprice']."', 'D')";
$ResultSet5 = mysqli_query($DBConnect, $SQLInsert2);
if (!$ResultSet5)
die("<p>Unable to execute the query.</p>");
}
?>
The first insert statement succeeds, and enters all the session variables into the database. However, the second always fails, and I'm unable to echo any session variables in any part of the page. They only seem to work inside that insert statement..
Again, sorry for how messy this code is, it's only a small piece of an even more disasterously complex script :rolleyes:
Thanks in advance 😃