View Single Post
Old 05-03-2005, 08:10 PM   #21 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 676
DJMaze is on a distinguished road
PHP Code:
<?PHP
error_reporting
(E_ALL); // added to check for bugs
include 'connect.inc.php';

//for new PHP
$title=$_GET[title];
$firstname=$_GET[firstname];
$lastname=$_GET[lastname];
$username=$_GET[username];
$password=$_GET[password];
$suburb=$_GET[suburb];
$city=$_GET[city];
$phonenumber=$_GET[phonenumber];
$dob=$_GET[dob];

$sql "INSERT INTO customer SET
           (title, firstname, lastname, username, password, address, suburb, city, phonenumber, dob)
           VALUES ('$title', '$firstname', '$lastname', '$username', '$password', '$address', '$suburb', '$city', '$phonenumber', '$dob')"
;
$result mysql_query($sql);
// error check added
// NOTE: uses === (triple =) which checks if the result is boolean AND false because 0==false is also true
if ($result === false) {
  die(
mysql_error());
}
echo 
"Thank you! Information entered.\n";
?>
I don't know the variable that is set inside connect.inc.php but if it's something like:
PHP Code:
$db_connection mysql_connect() 
then use
PHP Code:
$result mysql_query($sql$db_connection);
if (
$result === false) {
  die(
mysql_error($db_connection));

DJMaze is offline   Reply With Quote