View Single Post
Old 11-09-2009, 11:08 AM   #12 (permalink)
cskott
The Wanderer
 
Join Date: Nov 2009
Posts: 13
Thanks: 0
cskott is on a distinguished road
Default

?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?
cskott is offline  
Reply With Quote