I am able to fully update my SQL using PHP. No connection issues and no errors, so I'm not posting that info.
I simply need help on specifying my update query to not change the column if the new info is NULL
.
$sql4 = "update `Tickets` SET `newowner` ='".$_POST["ownernew"]."' where
`referencenumber` ='".$_POST["newref"]."'";
I will give some context
newowner
= the owner of a ticket in my ticketing system ( the column)ownernew
= is the field in which my update query pulls fromreferencenumber
= is the column for the unique ticket number, so it knows which row to update , by pulling it from thenewref
textbox
I currently have a select box , with the ID of ownernew
.
However, it has a default selection set, which has no value - so its currently sending nothing to the server and wiping out the current owner.
I want it, so if nothing is selected it doesn't update that one column.
I'm sure that I have to put if null
query in there, but I don't know where and how it should go in?