Even more interesting is the fact that I have several other scripts, none of them INSERT though, that all work without a hitch. Please help me! This is driving me crazy!!! Here is the script:
Code: Select all
<?php
include("config.php");
$connect = mysql_connect("$user_hostname", "$user_username", "$user_password");
mysql_select_db("$user_database", $connect);
$sql = "SELECT * FROM users WHERE userName = "$userName"";
$result = @mysql_query($sql) or die("Could not select from database");
$num = mysql_num_rows($result);
if($submit && empty($firstName) && empty($lastName) && empty($email) && empty($userName) && empty($passWord))
{
echo "<center>You need to enter all the fields</center>";
}
else if($num == "1")
{
echo "<center>The username is already registered, please try another.</center>";
}
else if($submit && !empty($firstName) && !empty($lastName) && !empty($email) && !empty($userName) && !empty($passWord) && $num == "0")
{
$insert = "INSERT INTO users VALUES ('', '$firstName', '$lastName', '$email', '$userName', '$passWord')";
$insert_res = @mysql_query($insert) or die("<center>Could not register account.</center>");
mkdir ("users/$userName");
echo "<center>Thank you $userName.<br/>Your account is active.<br/><a href="signin.php">Log In</a>!</center>";
}
mysql_close($connect);
?>