my code is messing up. help:
if (mysql_query("CREATE DATABASE $dbname",$con))
{
echo "Database Created<br>";
$dbase = $_POST["CallSign"]."char";
mysql_select_db($dbase, $con);
$sql = "SELECT * FROM $dbase";
$result = mysql_query($sql);
if ($result)
{
echo "CallSign Accepted<br>";
mysql_select_db("my_db", $con);
$sql="INSERT INTO users
(
CallSign,
Email,
FirstName,
MiddleName,
LastName,
Gender,
BirthMonth,
BirthDay,
BirthYear,
Location,
Password,
Origin,
) VALUES
(
'$_POST[CallSign]',
'$_POST[Email]',
'$_POST[FirstName]',
'$_POST[MiddleName]',
'$_POST[LastName]',
'$_POST[Gender]',
'$_POST[BirthMonth]',
'$_POST[BirthDay]',
'$_POST[BirthYear]',
'$_POST[Location]',
'$_POST[Password1]',
Now()
)";
if (mysql_query($sql,$con))
{
echo "Values Posted<br>";
$dbase = $_POST["CallSign"]."char";
mysql_select_db($dbase, $con);
$sql = "CREATE TABLE chars
(
charID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(charID),
CharName varchar(15),
CharPub TEXT,
CharPriv TEXT,
CharGame int DEFAULT '0',
CharBorn TIMESTAMP DEFAULT NOW()
)";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else
{
echo "Account Created";
echo "<p><a href='index.php'>Return to Login</a>";
}
}
else
{
$dbase = $_POST["CallSign"]."char";
mysql_select_db($dbase, $con);
$sql = "CREATE TABLE chars
(
charID int NOT NULL AUTO_INCREMENT,
PRIMARY KEY(charID),
CharName varchar(15),
CharPub TEXT,
CharPriv TEXT,
CharGame int DEFAULT '0',
CharBorn TIMESTAMP DEFAULT NOW()
)";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
else
{
echo "Callsign Reguested<br>Database Created<br>Tables Organized<br>Cajun Style<p>";
echo "Account Created";
echo "<p><a href='index.php'>Return to Login</a>";
}