title: mysql table fields - Resource id #7
body: <p>I have the following table in the database:</p>
  
  <pre><code>id, username, email, old_ip, current_ip
  </code></pre>
  
  <p>Everytime the user logs in, I want their current ip to be stored in current_ip. But before that I want to save their old_ip (from last login) so I thought I could move what is in current_ip to old_ip before copying the new data to current_ip.</p>
  
  <p>I wrote this script when logging in:</p>
  
  <pre><code>........
  $sql = mysql_query("SELECT * FROM members WHERE email='$email' AND password='$password'"); 
  $login_check = mysql_num_rows($sql);
  if($login_check &gt; 0){ 
     while($row = mysql_fetch_array($sql)){ 
      // Get member ID into a session variable
      $id = $row["id"];   
      session_register('id'); 
      $_SESSION['id'] = $id;
      // Get member username into a session variable
      $username = $row["username"];   
      session_register('username'); 
      $_SESSION['username'] = $username;
  
  
      // IP getting
      $old_ip = mysql_query("SELECT current_ip FROM members WHERE id='$id'");
      $result_old_ip = $old_ip;
      $sql_setoldip = mysql_query("UPDATE members SET old_ip='".$result_old_ip."' WHERE id='$id'");
  
  
      $getip = getenv("REMOTE_ADDR");
      $current_ip = $getip;
      // Update ip in database
      mysql_query("UPDATE members SET current_ip='".$current_ip."' WHERE id='$id'");
  
  }
  </code></pre>
  
  <p>The result I get in the old_ip feild is "Resource id #7" Any help please ?</p>