But if I do this:
put quotes around NULL:
if($val1 == '') {$val1 = 'NULL';}... etc. for all val's
and remove quotes around $valx:
$SQLselect= "INSERT INTO $table ( val1, val2, val3 )
VALUES($val1, $val2, $val3);";
I get this error:
You have an error in your SQL syntax near ' NULL, NULL, NULL )'
And if I alternatively do this:
no quotes around NULL:
if($val1 == '') {$val1 = 'NULL';}... etc. for all val's
and still remove quotes around $valx:
$SQLselect= "INSERT INTO $table ( val1, val2, val3 )
VALUES($val1, $val2, $val3);";
Then I get this error:
You have an error in your SQL syntax near ' , , , , , , , , )'
This way is the only way that doesnt get an error:
if($val1 == '') {$val1 = NULL;}... etc. for all val's
$SQLselect= "INSERT INTO $table ( val1, val2, val3 )
VALUES('$val1', '$val2', '$val3');";
I think its working because when I look up the database in phpMyAdmin it says NULL in the table and when I display the database table through my website it is an empty space.