View Single Post
Old 11-11-2009, 08:46 AM   #16 (permalink)
maeltar
The Acquainted
 
Join Date: Nov 2009
Location: nr Stratford-Upon-Avon
Posts: 137
Thanks: 3
maeltar is on a distinguished road
Default

Looks like you are just copy/pasting what's been put on here....

Code:
$link = mysql_connect($host, $username, $password) || die(mysql_error());
// mysql_select_db($database, $link)or die(mysql_error());
change to

Code:
$link = mysql_connect($host, $username, $password) || die(mysql_error());
mysql_select_db($database, $link)or die(mysql_error());

did you put the code inside php tags ?

Code:
<?PHP
error_reporting(E_ALL);

// Connect to server and select database.
$hostname = 'CHANGE ME';
$username = 'CHANGE ME';
$password = 'CHANGE ME';
$database = 'CHANGE ME';

$link = mysql_connect($host, $username, $password) || die(mysql_error());
mysql_select_db($database, $link)or die(mysql_error());

// Set some default data.
$name = 'John';
$lastname = 'Doe';
$email = 'user@example.com';
$id = 123145;

// update data in mysql database
$sql = "UPDATE " . $database .
       " 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, $link);

?>
__________________
Thanks... Simon

Sex, Drugs & Linux Rules
Send a message via MSN to maeltar
maeltar is offline  
Reply With Quote