I have been working on a page to insert a message into a forum, i am taking the user_ID from the user submitting the post from my table "users" and that query is working properly and i am able to get the ID using the current user name, but the same syntax to insert the forum POST variables into the database for the new topics it is giving me an error that just says query wasnt successful and gives no information about the error.

here is the code
PHP Code:

require_once 'header.php';
// If the form was submitted, scrub the input (server-side validation)
// see below in the html for the client-side validation using jQuery






if (isset($_POST['first_name'])
    && isset(
$_POST['last_name'])
    && isset(
$_POST['user_email'])
    && isset(
$_POST['state'])
    && isset(
$_POST['user_name']) 
    && isset(
$_POST['user_pass']) 
    && isset(
$_POST['user_pass_check'])
) {
    
$first_name $db->real_escape_string($_POST['first_name']);
    
$last_name $db->real_escape_string($_POST['last_name']);
    
$user_name $db->real_escape_string($_POST['user_name']);
    
$user_pass $db->real_escape_string($_POST['user_pass']);
    
$user_pass_check $db->real_escape_string($_POST['user_pass_check']);
    
$user_email $db->real_escape_string($_POST['user_email']);
    
$state $db->real_escape_string($_POST['state']);


    
$query "INSERT INTO users(first_name, last_name, user_email, mailing_address, user_name, user_pass) VALUES('$first_name', '$last_name', '$user_email', '$state', '$user_name', '$user_pass')";

    if (!
$db->query($query))
        echo 
"INSERT failed: $query<br />" mysql_error() . "<br /><br />";
    else {
        echo 
"Thank you for signing up, <a href='index.php'>Click Here</a> to continue to the home page and sign in.";
        
$_SESSION['user'] = $user_name;
        
$_SESSION['pass'] = $user_pass;

    }



    
$errors = array();
 
  
} else {
   
//Display the form
echo <<<_END
<br>
   <form action="signup.php" method="post" id="register-form" novalidate="novalidate">
   <pre>
   First Name:       <input type="text" name="first_name" />


   Last Name:        <input type="text" name="last_name" />


   Email Address:    <input type="text" name="user_email" />


   State:            <input type="text" name="state" />


   User Name:        <input type="text" name="user_name" />


   Password:         <input type="password" name="user_pass" />


   Confirm Password: <input type="password" name="user_pass_check" />


                     <input type="submit" value="Sign Up" />

   </pre>
  </form>

_END;