<?
$data = @mysql_connect('localhost','root','password');
if (!$data) {
echo('<p>Unable to connect to the '. 'database server at this time.</p>' );
exit();
}
mysql_select_db('FYP', $data);
if (! @mysql_select_db('FYP') ) {
echo( '<p>Unable to locate the FYP ' . 'database at this time.</p>' );
}
$Full=$_POST['full'];
$Username=$_POST['user'];
$NRIC=$_POST['nric'];
$Address=$_POST['address'];
$Postal=$_POST['postal'];
$Email=$_POST['email'];
$Password=$_POST['password'];
$HP=$_POST['hp'];
$Home=$_POST['home'];
$Date=$_POST['Extra4'];
$Month=$_POST['Extra5'];
$Year=$_POST['Extra6'];
$Gender=$_POST['gender'];
$sql = "INSERT INTO Members (Full, Username, NRIC, Address, Postal, Email, Password, HP, Home, Date, Month, Year, Gender)
VALUES('$Full', '$Username', '$NRIC', '$Address', '$Postal', '$Email', '$Password', '$HP', '$Home', '$Date', '$Month', '$Year', '$Gender');
$result = mysql_query($sql) or errorhandle();
Function errorhandle(){
$error_num = mysql_errno();
$error_detail = mysql_error();
die ("There has been an error creating your account. Please contact the Webmaster. $error_num ,<br> $error_details");
}
?>
would this be better?