user1557515
user1557515

Reputation: 109

INSERT VALUES into empty column

 $querychange = 
  mysql_query("UPDATE table SET clounm='$newvale' WHERE email='$email'") 

but put $newvalue into the nearest empty cell

Upvotes: 0

Views: 16088

Answers (2)

Dru
Dru

Reputation: 556

Is this what your looking for

UPDATE table SET clounm='$newvale' WHERE email IS NULL LIMIT 1

Upvotes: 0

bryan.blackbee
bryan.blackbee

Reputation: 1954

Consider the following code:

UPDATE `table_name` SET `col_name` = `col_value` WHERE `record_name` = 'ID'

for example

UPDATE `student` SET `marks` = 50 WHERE `name` = 'Jack'

This will set all records with name Jack to 50 marks.

Upvotes: 1

Related Questions