B
ben
Guest
Here is my PHP coding....
<?php
if($_POST['username1']&&
$_POST['password1'])
{
$username = $_POST["username1"];
$password = $_POST["password1"];
$databaseusername = "root";
$databasepassword = "";
$createemailaccount = $username;
$con = mysql_connect(localhost,$databaseusername,$databasepassord);
$continueregister1 = "@mysql_select_db($username) or die('Unable to select the database')";
$continueregister2 = "DROP TABLE IF EXISTS $username.deleted";
$continueregister3 = "CREATE TABLE deleted (From varchar(256) NOT NULL,Subject varchar(256) NOT NULL,Date carchar(256) NOT NULL,Message text)";
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE $username",$con))
{
mysql_query($continueregister1);
mysql_query($continueregister2);
mysql_query($continueregister3);
echo "Database created!";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
}
else
{
?>
<html>
<head>
<title>Mailster</title>
<body>
<form name="register" method="post" action="Register.php">
Username: <input type="text" name="username1" /><br />
Password: <input type="text" name="password1" /><br />
<input type="submit" name="register" value="Register" />
</form>
</body>
</html>
<?php
}
?>
I need to know how to make it check for tables....like Im pretty sure I got this wrong.. $continueregister2 = "DROP TABLE IF EXISTS $username.deleted";
What is the correct PHP coding?
Thank you!
<?php
if($_POST['username1']&&
$_POST['password1'])
{
$username = $_POST["username1"];
$password = $_POST["password1"];
$databaseusername = "root";
$databasepassword = "";
$createemailaccount = $username;
$con = mysql_connect(localhost,$databaseusername,$databasepassord);
$continueregister1 = "@mysql_select_db($username) or die('Unable to select the database')";
$continueregister2 = "DROP TABLE IF EXISTS $username.deleted";
$continueregister3 = "CREATE TABLE deleted (From varchar(256) NOT NULL,Subject varchar(256) NOT NULL,Date carchar(256) NOT NULL,Message text)";
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
if (mysql_query("CREATE DATABASE $username",$con))
{
mysql_query($continueregister1);
mysql_query($continueregister2);
mysql_query($continueregister3);
echo "Database created!";
}
else
{
echo "Error creating database: " . mysql_error();
}
mysql_close($con);
}
else
{
?>
<html>
<head>
<title>Mailster</title>
<body>
<form name="register" method="post" action="Register.php">
Username: <input type="text" name="username1" /><br />
Password: <input type="text" name="password1" /><br />
<input type="submit" name="register" value="Register" />
</form>
</body>
</html>
<?php
}
?>
I need to know how to make it check for tables....like Im pretty sure I got this wrong.. $continueregister2 = "DROP TABLE IF EXISTS $username.deleted";
What is the correct PHP coding?
Thank you!