Hy,
is there a way to update a column to a null value in a statement like the folowing :
$smcFunc['db_query']('', "
UPDATE `{db_prefix}mytable`
SET
`name` = {string:name},
`fk_dummy` = {int:id_dummy}
WHERE
`id` = {int:id}",
array('name' => 'test', 'id_dummy' => '', 'id' => 1));
the column is a foreign key so i can't just insert 0 or -1
Thanks
Probably something like:
$smcFunc['db_query']('', "
UPDATE `{db_prefix}mytable`
SET
`name` = {string:name},
`fk_dummy` = {raw:id_dummy}
WHERE
`id` = {int:id}",
array('name' => 'test', 'id_dummy' => 'null', 'id' => 1));
Lainaus käyttäjältä: emanuele - marraskuu 16, 2013, 06:09:52 AP
Probably something like:
$smcFunc['db_query']('', "
UPDATE `{db_prefix}mytable`
SET
`name` = {string:name},
`fk_dummy` = {raw:id_dummy}
WHERE
`id` = {int:id}",
array('name' => 'test', 'id_dummy' => 'null', 'id' => 1));
that worked
thank you
Btw, SMF doesn't make this easier because SMF doesn't use null itself in any column, and there is actually a performance saving at the database level if a table has no null columns.