I have a function which adds varhcars and integers into a database row
public function addItem($id, $site, $price, $quantity, $condition,
$sellerName, $sellerRating, $sellerLocation, $description, $link){
$q = "INSERT INTO tbl_items VALUES(
'$id',
'$site',
$price,
$quantity,
'$condition',
'$sellerName',
$sellerRating,
'$sellerLocation',
'$description',
'$link',
".time().")";
return mysql_query($q, $this->connection);
}
There may be situations where I may decide that I want to set a varchar value to NULL, but the problem is if I send the string NULL as a parameter it will always be treated as a string.
e.g.
addItem("id1", "site1", 100, NULL, "NULL", "NULL", "NULL", "NULL", "NULL", "NULL",);
How do I avoid NULL being treated a string in my query?