i want to update my columns with different content.
This is my table structure
+----+---------+
| id | content |
+----+---------+
| 2 | abc |
+----+---------+
| 14 | def |
+----+---------+
From my code i am able to update only single column only.
can anyone help me please...
PHP Code:<?php
$hostname = "localhost";
$username = "";
$password = "";
$database = "";
// Connect to the database
mysql_connect($hostname, $username, $password) OR DIE("Unable to connect");
mysql_select_db("$database") or die("Unable to select database");
if (isset($_POST['ud_date'])) {
$query = sprintf("UPDATE test_mysql SET content='%s' WHERE id=%d",
mysql_real_escape_string($_POST['ud_date']),
2);
if (mysql_query($query)) {
echo 'update query succeeded';
} else {
else echo 'update query failed';
}
} else {
echo 'please submit the form';
}




Reply With Quote