in using PHP to insert data from a form into a database. how exactly can you insert NULL values into the table
I have been reading up and experimenting but i just don't get the picutre.
i have the following query
Code: Select all
$query = sprintf("INSERT INTO careers VALUES ('','%s','%s','%s','%s','%s','%s','%s','%s')",$postdate,$position,$image_file,$criteria,$deadline,$email,$sendto,$publish);Code: Select all
$image_file = (empty($_POST['file']))? NULL : $_POST['file'];So how do i get aounrd this. i have been looking at the DEFAULT and IFNULL() functions in mysql however i havent seen it being used in INSERT statments but rather SELECT i have been trying to create a query string using these functions but i dont get it
Code: Select all
INSERT INTO table VALUES('',NULLIF('%s',NULL)) // where '%s' is $image_file...Kendall[/b]