I want to update data into a column in a table only if the data sent from the HTML page is not NULL or ''. Else, that column must not be touched. Example :-
table_1
id name age rent
==========================================
1 Name 1 25 1000
2 Name 2 28 NULL
3 Name 3 35 1500
4 Name 4 44 3200
5 name 5 42 NULL
LET THE DATA SENT FROM HTML PAGE IS STOERED IN A VARIABLE today_rent
AND THIS VARIABLE IS SENT TO MYSQL.
MySQL Query
IF(today_rent !=null OR today_rent != '') THEN
UPDATE table_1 SET rent=today_rent WHERE id=2
END IF;
Is there any other way to do it?