Thanks for the reply. I see what you mean and have modified to use seperate queries.
Now 1 of the table updates but the other doesnt and i get the following syntax error:
"You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Dec) VALUES ('Tom', '5', 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0)' at line 1"
Heres the modified code:
$insertSQL = sprintf("INSERT INTO vegetable (TypeID, Name, EnvID, ThinOutInDays, Moisture, Hardiness, Soil, Light, Details, HarvestInDays, Username) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['TypeID'], "int"),
GetSQLValueString($_POST['Name'], "text"),
GetSQLValueString($_POST['EnvID'], "int"),
GetSQLValueString($_POST['ThinOutInDays'], "int"),
GetSQLValueString($_POST['Moisture'], "text"),
GetSQLValueString($_POST['Hardiness'], "text"),
GetSQLValueString($_POST['Soil'], "text"),
GetSQLValueString($_POST['Light'], "text"),
GetSQLValueString($_POST['Details'], "text"),
GetSQLValueString($_POST['HarvestInDays'], "int"),
GetSQLValueString($_POST['Username'], "text"));
mysql_select_db($database_connect, $connect);
$result1 = mysql_query($insertSQL, $connect) or die(mysql_error());
$vegeid = mysql_insert_id();
$insertSQL_b = sprintf("INSERT INTO outdoorsowtime (Username, VegeID, Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec) VALUES (%s, '$vegeid', %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['Username'], "text"),
GetSQLValueString(isset($_POST['Jan']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Feb']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Mar']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Apr']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['May']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Jun']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Jul']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Aug']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Sep']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Oct']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Nov']) ? "true" : "", "defined","1","0"),
GetSQLValueString(isset($_POST['Dec']) ? "true" : "", "defined","1","0"));
$result2 = mysql_query($insertSQL_b, $connect) or die(mysql_error());
I think im really close now but just cant work out this error...
Please help 🙂