basically im getting code from a form entered by a user.
if the userStatus = accountJ then i want the data to be stored in the user table and journalist table
if the userStatus = accountM then i want the data to be stored in the user table and Manager table
if the userStatus = accountE then i want the data to be stored in the user table and editor table
if i run this code without the if statement it will execute perfectly though when i try it with the
if statement i get a blank screen and nothing is stored in my database.
Code: Select all
$userStatus = $_POST['userStatus'];
if ($userStatus == "accountJ"){
$query = "insert into users (username, password, userStatus) VALUES (
'".mysql_escape_string($_POST['username'])."', '".mysql_escape_string($_POST['password'])."',
'".mysql_escape_string($_POST['userStatus'])."')";
if(!mysql_query($query) ) {
print "Error with query: \"$query\"<br>".mysql_error();
// Simple error handling...
}
$query = "insert into journalist (username, journ_fname, journ_lname) VALUES (
'".mysql_escape_string($_POST['username'])."', '".mysql_escape_string($_POST['firstname'])."',
'".mysql_escape_string($_POST['lastname'])."')";
if(!mysql_query($query) ) {
print "Error with query: \"$query\"<br>".mysql_error();
// Simple error handling...
}
}
else{
echo 'this is no good';
}
?>