11-09-2009, 12:08 PM
|
#11 (permalink)
|
|
The Wanderer
Join Date: Nov 2009
Posts: 13
Thanks: 0
|
?php
$host = 'localhost'; // Host name
$username = 'xx'; // Mysql username
$password = 'xx'; // Mysql password
$db_name = 'xx'; // Database name
$tbl_name = 'test_mysql'; // Table name
// Connect to server and select database.
mysql_connect($host, $username, $password)or die("cannot connect");
mysql_select_db($db_name)or die("cannot select DB");
// update data in mysql database
$sql = "UPDATE " . mysql_real_escape_string($tbl_name) .
" SET name='" . mysql_real_escape_string($name) .
"', lastname='" . mysql_real_escape_string($lastname) .
"', email='" . mysql_real_escape_string($email) .
"' WHERE id='" . mysql_real_escape_string($id) . "'";
$result = mysql_query($sql);
// if successfully updated.
if($result){
echo "Successful";
echo "<BR>";
echo "<a href='list_records.php'>View result</a>";
}else {
echo mysql_error();
}
I have changed the file to this now.
It tell's me that the database is successfully updated, but it still doens't update the database?
|
|
|
|