Ok, so here goes. I have this code which I think is perfect, but is obviously not. The problem is where it says "Problem lines are the following two", which is where it echoes "Array", and that's it. It's not supposed to do that. Please help
<?php
mysql_connect("databases.birid.org","username","password") or die('Could not connect: ' . mysql_error());
$username = $_POST['user'];
$cleanu = mysql_real_escape_string($username);
$password = $_POST['pass'];
$cleanp = mysql_real_escape_string($password);
$dragoncave = $_POST['dragcaveuser'];
$cleand = mysql_real_escape_string($dragoncave);
$cleanu = preg_replace('([ ]+)', ' ', $cleanu);
$cleanp = preg_replace('([ ]+)', ' ', $cleanp);
$cleand = preg_replace('([ ]+)', ' ', $cleand);
if($cleanu == " " || $cleanp == " " || $cleanp == " ")
{
echo("You did not enter either a username, password, or a Dragcave username. Please click <a href=\"http://www.birid.org/dragcave/balancer/register.php \">here</a> and try again. Thank you.");
return;
}
mysql_select_db("biriddragons") or die ('Could not select database: ' . mysql_error());
$check = mysql_query("SELECT COUNT(user) as cnt FROM userinfo WHERE user = '{$cleanu}'");
if (!$check)
{
die('Could not query:' . mysql_error());
}
if((mysql_result($check, 0, 0)) == 1)
{
echo("This account username already exists. Please try again <a href=\"http://www.birid.org/dragcave/balancer/register.php \">here</a> and try again with a different username. Thank you.");
return;
}
/*
1. Create confirmation codes
2. Call last ID# */
mysql_query( "INSERT INTO userinfo (user, pass, conf1, conf2, dragcavename)
VALUES ('{$cleanu}', '{$cleanp}', '{$conf1}', '{$conf2}', '{$cleand}')");
//PROBLEM LINES ARE THE FOLLOWING TWO
$d = mysql_query("SELECT id FROM userinfo WHERE user = '{$cleanu}'");
echo mysql_fetch_array($d);
mysql_query (
"CREATE TABLE `$id`
(
Egg_ID varchar(4),
Click bool,
Views int
)");
echo ("<p> Your account has been registered. You may now log in <a href=\"http://www.birid.org/dragcave/balancer/login.php \" > here. </a> ") ;
?>