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

but put $newvalue into the nearest empty cell

6
  • How is the specific table row specified? For the null check, you can use where yourColumn is null. Commented Jul 27, 2012 at 13:42
  • Post some sample data eith expected result Commented Jul 27, 2012 at 13:42
  • 1
    Also note that you can only update a column of existing row Commented Jul 27, 2012 at 13:43
  • I could make it null, then what would the mysql code be? Commented Jul 27, 2012 at 13:44
  • 2
    user1557whatever, if your table design resembles excel sheet - then your table design is wrong. use table (x int, y int, value int) and transform to excel-like-table on demand... Commented Jul 27, 2012 at 13:49

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

yes but in the code there is a session variable which =$email so only that row can be changed
0

Is this what your looking for

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

1 Comment

that sounds like what I'm looking for I'll try it out, TVM for the post.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.