I was wondering if i can have someone look over my statements to see where i might be screwing up. I've tested what information is being posted by echoing it and everything seems to be going through correctly, but I can't get it to physically create the appropriate records. I also do not get any errors and it goes back to the header location like the form did post.
//First we make sure there are enough licenses left to add the user
$limit = "select * from organization_seats WHERE orgid=$orgid";
$orglimit = mysql_query($limit);
$licenses = $orglimit['limit'];
$count = "select count(*) from organization_users WHERE organizationid=$orgid";
if ((!$licenses < $count)) {
echo 'You have reached the number of maximum licenses for your Organization.';
} else {
//If we have licenses left, proceed to add new user
//Populate the user table
$sql = "insert into user (firstname, lastname, title, address1, address2, country, city, state, zip, phone, mobile, birthday, username, email, password) values ('$fname','$lname','$title','$address1','$address2','$country', '$city', '$state', '$zip', '$phone', '$mobile', '$bday', '$username', '$email', '$password')";
$exec = mysql_query($sql);
//Add the user to the organization
$userid = mysql_insert_id(); //call the last ID entered into the user table first
$sql2 = "insert into organization_users(organizationid, userid, active) values ('$orgid', '$userid', $)";
$exec = mysql_query($sql2);
//recall the userid
$sql3 = "select * from user where username = $username";
$exec = mysql_query($sql3);
$newuserid = $newuserselect['id'];
//Add the user to the department
$sql4 = "insert into organization_dep_users(orgid, depid, userid) values ('$orgid', '$department', '$newuserid')";
$exec = mysql_query($sql4);
if ($exec === TRUE) {
header( 'Location: index.php' ) ;
} else {
echo mysql_error();
}
}
btw, i do have mysql_real_escape_string attached to all my variables.