khaja.jab wrote:i have 2 id's, these id's are auto-increment, so i have 2 id's that is first one is id.no2 second one is id.no14
when i am updating id no. 2 it was changing automatically 14 also. now got my point.
Yes. That is, you are confused as to what is a row and what is a column. Basically, you can imagine your database table to be something like this:
+----+---------+
| id | content |
+----+---------+
| 2 | abc |
+----+---------+
| 14 | def |
+----+---------+
Now, this is a row:
+----+---------+
| 2 | abc |
+----+---------+
This is a column:
+---------+
| content |
+---------+
| abc |
+---------+
| def |
+---------+
What you want to do is update the content column for the row in which the id is 2. However, the query that you are actually running updates the content column for all the rows. Therefore, as I told you earlier, you need a WHERE clause:
$query = sprintf("UPDATE test_mysql SET content='%s' WHERE id=%d",
mysql_real_escape_string($_POST['ud_date']),
2);