I'm trying to insert blank values into numeric fields. I'm using form data, and the code looks something like this:
$queryString = "insert into testtable set
tt_number = {$_POST["number"]},
tt_text = '{$_POST["text"]}'
";
But when the numeric field has been left blank -- which is okay, the corresponding database field can be null -- the statement fails.
I'm thinking of trying
$queryString = "insert into testtable {$fieldString} values {$valueString}";
after building the $fieldString and $valueString variables by going through the form variables one by one and including them if they've been populated, but that seems like an awful lot of work.
Is there some easy -- or at least common or standard -- way of doing this?
Thanks,
Rich