Here is where I am at now:
Code:
$addUser = $SERVER['PHP_SELF'];
if (isset($POST['Submit'])) {
$Username = $POST['Username'];
$Password = $POST['Password'];
$FirstName = $POST['FirstName'];
$LastName = $POST['LastName'];
$Email = $POST['Email'];
$AccessLevel = $POST['AccessLevel'];
mysql_select_db($database_connMI, $connMI) or die ('<p>Could not select the database because <b>' .mysql_error().'</b></p>');
$insert = "INSERT INTO `user` (Username, Password, FirstName, LastName, Email, AccessLevel) VALUES ('$Username', '$Password', '$FirstName', '$LastName', '$Email', '$AccessLevel')";
$addUser = mysql_query($insert);
//DEBUG - print the variables
echo "<p>The insert variable is $insert <br /></p>";
echo "<p>The add user query result is $addUser <br /><br /></p>";
echo "<p>Testing the variables. They are:<br />Username: $Username <br />Password: $Password <br />Firstname: $FirstName <br />LastName: $LastName <br />AccessLevel: $AccessLevel <br /><br /></p>";
//execute the query
if (@ ($addUser)) {
//echo "<p>The add user query was successfully executed. The query was $addUser.</p>";
header ("Location: ./index.php"); //redirect to User index page
mysql_close(); //close the database
exit(); //exit the script
} else {
echo "<p>Could not add the entry because: <b>" .mysql_error(). "</b>.<br /> The query was $addUser.</p>";
}
}
[/COLOR]
Results:
The insert variable is INSERT INTO user (Username, Password, FirstName, LastName, Email, AccessLevel) VALUES ('Skoki', 'woof', 'Skoki', 'Dog', 'woof@woofmail.com', '3')
The add user query result is 1
Testing the variables. They are:
Username: Skoki
Password: woof
Firstname: Skoki
LastName: Dog
Email: woof@woofmail.com
AccessLevel: 3
Could not add the entry because: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '1' at line 1.
The query was 1.
What is interesting is that everything is in the query variable appears to be correct, the query appears to be correct, and the result is correct.
If all is correct, I cannot understand the error in my SQL syntax - I have used it in the past without fail. Having touble determining what "near '1' at line 1" is referring to.
The query simply determines if it has been executed. Now if the returned value exists as either a 0 or a 1 , it should work through the conditional statement. Am I not correct here?
If you wish, I will send some code of an example that works just fine if that would assist.
Thanks again!