Hi,
For one of my functions, I need to remove a value from a table, so I thought about setting it to NULL:
function removeDosLoc($file){
// Remove the old location, if any
$res = pg_query(CNX_DOS, "SELECT id,file,category FROM dossiers_location WHERE file = '$file'");
$num = pg_num_rows($res);
if ($num !== 0) {
$fields = array('file' => NULL);
$condition = array('file' => $file);
pg_update(CNX_DOS,"dossiers_location", $fields, $condition) or die("removeDosLoc: failed");
}
}But I always get the die()-error. I use the same function to set the value to $file, so the function should be working - all I can think of is the 'NULL' that is incorrect? Or not?
thanks!
/EDIT: oh, and BTW: I checked that $num equals 1, so it is not a problem of $num being > 1 (the column is set to UNIQUE, so it couldn't be that problem...)