title: Data not storing to sql database from php session start variable
body: <p>I'm trying to store user input in to my sql table as seen below,
  <a href="http://goawaymom.com/test.png" rel="nofollow noreferrer">my database http://goawaymom.com/test.png</a></p>
  
  <p>I query the users for their 'email', 'firstname', 'last name', and 'about' after they register  <a href="http://goawaymom.com/login/register.php" rel="nofollow noreferrer">here.</a> However what ever I do, the user input does not save to the database. I THINK but am NOT sure that this is a problem with my session_start variable. I believe the session is not starting/saving properly unique to the user that has registered. I based my code of this <a href="http://www.youtube.com/watch?v=ruoptcAx-BQ&amp;feature=BFa&amp;list=SP074EAEF57B0DA2A4" rel="nofollow noreferrer">tutorial</a> as I am new to PHP. </p>
  
  <p>editprofile.php</p>
  
  <pre><code>&lt;?php
  session_start();
  
  include('core/init_inc.php');
  
  if(isset($_POST['email'], $_POST['about'], $_POST['firstname'], $_POST['lastname'])){
  $errors = array();   
  if (filter_var($_POST['email'], FILTER_VALIDATE_EMAIL) === false){
      $errors[] = 'The email address you entered is not valid';    
  }
  if (empty($errors)){
      set_profile_info($_POST['email'],$_POST['about']);
  }
  $user_info = array(
      'email'     =&gt; htmlentities($_POST['email']),
      'about'     =&gt; htmlentities($_POST['about']),
      'firstname'     =&gt; htmlentities($_POST['firstname']),
      'lastname'     =&gt; htmlentities($_POST['lastname'])
  );
  } else {
  $user_info = fetch_user_info($SESSION['uid']);
  }
  ?&gt;
  </code></pre>
  
  <p>Any help would be greatly appreciated. Once again my question is, why isn't the data from my editprofile.php form saving in to my php sql database and how do i fix this. Thanks in advance, and if more code is needed then I'd be willing to provide it. The form can be accessed <a href="http://goawaymom.com/login/register.php" rel="nofollow noreferrer">here</a>, upon registering for the website.</p>
  
  <pre><code>function fetch_users() {
  $result = mysql_query('SELECT `user_id` AS `id`, `username` FROM `users`');
  
  $users = array ();
  
  while (($row = mysql_fetch_assoc($result)) !== false){
      $users[ ] = $row;
  }
  
  
  return $users;
  
  }
  //fetches profile information for the given user
  function fetch_user_info($uid){
  $uid = (int)$uid;
  
  $sql = "SELECT
              `username`,
              `user_firstname` AS `firstname`,
              `user_lastname` AS `lastname`,
              `user_about` AS `about`,
              `user_email` AS `email`
          FROM `users`
          WHERE `user_id` = {$uid}";
  
  $result = mysql_query($sql);        
  return mysql_fetch_assoc($result);
  
  
  }
  
  //updates the current user profile info
  function set_profile_info($email, $about){
  $email = mysql_real_escape_string(htmlentities($email));
  $about = mysql_real_escape_string(nl2br(htmlentities($about)));
  
  
  $sql = "UPDATE `users` SET
          `user_email` = `{$email}`,
          `user_about` = `{about}`
      WHERE `user_id` = {$_SESSION[`uid`]}";
  mysql_query($sql);
  }
  ?&gt;
  </code></pre>