View Single Post
Old 05-03-2005, 09:25 PM   #23 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 704
DJMaze is on a distinguished road
hmm i think you misunderstood me.
the "error" doesn't belong in connect.inc.php
PHP Code:
<?PHP
//Include file

//Connect to the database
$db=mysql_connect("localhost""xxx""xxx")
or die(
"Could not connect to localhost.");

//Select database
if (!@mysql_select_db("techdatabase",$db))
{
    exit(
'<p>Unable to select database.</p>'); // or use die(mysql_error($db)) ;)
} else {
    
//Connection successful
}
Then inside your reg.inc.php use
PHP Code:
$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($db)); // show BUFFY the error why the query fails ;)

DJMaze is offline   Reply With Quote