Using a simple form I am posting into database. However its only posting into the first table ($sql) and not the second ($sql2). But I can not work out why. All the names match the values ect...
Am I missing something stupid. Any assistance would be great. Here is the part where its inserting $sql but not $sql2
I appreciate that the question of inserting data into to tables has been asked. However its not worked for me and want to check if I am missing something silly or going about this the wrong way.
$sql = "INSERT INTO accounts ( reg, acc, accstatus, carrfloor, carramid) 
VALUES ( '{$db->real_escape_string($_POST['reg'])}', 
         '{$db->real_escape_string($_POST['acc'])}', 
         '{$db->real_escape_string($_POST['accstatus'])}', 
         '{$db->real_escape_string($_POST['floor'])}',   
         '{$db->real_escape_string($_POST['carramid'])}' )"; 
   
$sql2 = "INSERT INTO platform ( platform, name, platformstatus, platformtype) 
VALUES ( '{$db->real_escape_string($_POST['platform'])}', 
         '{$db->real_escape_string($_POST['name'])}',
         '{$db->real_escape_string($_POST['platformstatus'])}',    
         '{$db->real_escape_string($_POST['platformtype'])}' )";
   
$insert = $db->query($sql); 
$insert2 = $db->query($sql2); 
if ($insert && $insert2) { 
echo "<font color='red'>Inserted Successfully</font>"; 
//header('Location: index');
} else { 
echo "<font color='red'>Woops! Something Went Wrong :|</font>"; 
} 
$db->close(); 
} 
 ?> 