I was wondering if there was a way to create a new user for my MySQL Database? I'm trying to add basic log-in functionality that will allow the user to connect to database. If user has no account, then I want to create a new one. This is what I have so far:
<html>
<head>
<title>Test</title>
</head>
<body>
<?php
$username = "root";
$password = "root";
$hostname = "localhost";
//connection to the database
$dbhandle = mysql_connect($hostname, $username, $password)
or die("Unable to connect to MySQL");
echo "Connected to MySQL<br>";
$selected = mysql_select_db("contactsDB",$dbhandle)
or die("Could not select examples");
echo "Found contacts DB";
?>
</body>
Everything connects properly, but now, instead of having to type in the username and password (root), I want user to type their username and password. Again, if they don't have one, then I want to create a new one.