Im trying to design a website for a school project and I created this code for the registration page.
$userreg = $_POST[newuser]; $passreg = $_POST[newpass];
$taken = false; $database = seniorproject; $password = ; $username = root;
if($userreg&&$passreg)
$con = mysql_connect(localhost,$username,$password) or die ("Unable to log in to database"); ***($database, $con) or die ("Unable to connect");
mysql_query("INSERT INTO user VALUES(,$userreg, $passreg)") or die ("Error");
echo "Account Creation Successful";
mysql_close($con);
header("Location: index.html");
else echo "Error: You need to have both a username and password";
?> But it keeps giving me this error: Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /Applications/XAMPP/xamppfiles/htdocs/register.php:13 Stack trace: #0 main thrown in /Applications/XAMPP/xamppfiles/htdocs/register.php on line 13
Whats wrong? any help would be appreciated, thanks guys!
|