I have tried this code, but i'm getting errors
$sql[0] = "INSERT INTO classtb
(classname, duration, classdate, cost, location,
instructor, client, subclient, courseware, note)
VALUES('$classname', '$duration', '$classdate', '$cost',
'$loc2name', '$instructor','$client','$subclient',
'$courseware', '$note')";
$sql[1] = "INSERT INTO locationtb(slocation, address, note)
VALUES('$loc2name', '$loc2address', '$loc2note')";
//etc...
foreach ($sql as $x) {
if ($db->query($sql[$x])) {
echo "worked";
else{
echo "Didn't work";
}
}
I'm getting double error as both are not loading into the tables
You need to use the value of the $sql
array inside your loop.
Change the following...
$db->query($sql[$x])
To...
$db->query($x)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments