title: Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0
body: <p>I am getting this warning everything us working fine the user DTA is going to mysql but when I user login I get this warning idk how to remove it and I also used this but it get me more errors and I searched all google but didn't find a solid solution to fix this so I cane here pls just answer question don't invite or relate this question to any other anyway this is the statement I used</p>
  <pre><code>&lt;?php mysql_free_result($result); ?&gt;
  </code></pre>
  <p>Error</p>
  <pre><code>Warning: Unknown: 1 result set(s) not freed. Use mysql_free_result to free result sets which were requested using mysql_query() in Unknown on line 0
  
  </code></pre>
  <p>Code</p>
  <pre><code>
  &lt;style&gt;
  &lt;?php include 'signin.css'; ?&gt;
  &lt;/style&gt;
  &lt;script type=&quot;text/javascript&quot; src=&quot;signup.js&quot;&gt;&lt;/script&gt;
  &lt;?php
  //signin.php
  include 'connect.php';
  include 'header.php';
   
  
   
  //first, check if the user is already signed in. If that is the case, there is no need to display this page
  if(isset($_SESSION['signed_in']) &amp;&amp; $_SESSION['signed_in'] == true)
  {
      echo 'You are already signed in, you can &lt;a href=&quot;signout.php&quot;&gt;sign out&lt;/a&gt; if you want.';
  }
  else
  {
      if($_SERVER['REQUEST_METHOD'] != 'POST')
      {
          /*the form hasn't been posted yet, display it
            note that the action=&quot;&quot; will cause the form to post to the same page it is on */
          echo '&lt;form action=&quot;&quot; method=&quot;post&quot;  &gt;
  &lt;div class=&quot;all&quot; &gt;
  &lt;div class=&quot;container&quot; &gt;
  &lt;div class=&quot;first&quot; &gt;
  &lt;h2&gt;SIGN IN&lt;/h2&gt;
  &lt;/div&gt;
  &lt;div class=&quot;user&quot; &gt;
  &lt;input class=&quot;use&quot;  type=&quot;text&quot; placeholder=&quot;Username&quot; id=&quot;username&quot; name=&quot;user_name&quot; required&gt;
  &lt;/div&gt;
  &lt;div class=&quot;userimg&quot; &gt;
  &lt;img  src=&quot;user.png&quot; style=&quot;height:2em;width:2em;&quot; &gt;
  &lt;/div&gt;
  &lt;div class=&quot;pass&quot; &gt;
  &lt;input type=&quot;password&quot; placeholder=&quot;Password&quot; id=&quot;password&quot;  name=&quot;user_pass&quot; minlength=&quot;8&quot; required  &gt;
  &lt;img src=&quot;lock.png&quot; &gt;
  &lt;/div&gt;
  &lt;div class=&quot;show&quot;&gt;
  &lt;img src=&quot;visible.png&quot; id=&quot;visible&quot; class=&quot;visible&quot; onclick=&quot;myFunction()&quot;&gt;
  &lt;img src=&quot;invisible.png&quot; id=&quot;invisible&quot;  class=&quot;invisible&quot; onclick=&quot;mynot()&quot; &gt;
  &lt;/div&gt;
  &lt;div class=&quot;check&quot; &gt;
  &lt;input type=&quot;checkbox&quot; required &gt;
  &lt;/div&gt;
  &lt;div class=&quot;box&quot; &gt;
  &lt;p&gt;I accept all &lt;a href=&quot;#&quot; &gt;terms&lt;/a&gt; and &lt;a href=&quot;#&quot; &gt;privacy&lt;/a&gt;.&lt;/p&gt;
  &lt;/div&gt;
  &lt;div class=&quot;submit&quot; &gt;
  &lt;input type=&quot;submit&quot; name=&quot;submit&quot; onclick=&quot;submit()&quot; value=&quot;Sign in&quot;&gt;
  &lt;/div&gt;
  &lt;div class=&quot;close&quot; &gt;
  &lt;input type=&quot;button&quot; value=&quot;Back&quot;  &gt;
  &lt;/div&gt;
  &lt;div class=&quot;log&quot; &gt;
  dont have an account? &lt;a href=&quot;#&quot; &gt;Login&lt;/a&gt;
  &lt;/div&gt;
  &lt;div class=&quot;organic&quot; &gt;
  &lt;img src=&quot;logo.png&quot; class=&quot;organicpe&quot; &gt;
  &lt;/div&gt;
  &lt;div&gt;
  &lt;h2 class=&quot;back&quot; &gt;&lt;a href=&quot;#&quot; &gt;Go Back&lt;/a&gt;&lt;/h2&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;';
      }
      else
      {
          /* so, the form has been posted, we'll process the data in three steps:
              1.  Check the data
              2.  Let the user refill the wrong fields (if necessary)
              3.  Verify if the data is correct and return the correct response
          */
          $errors = array(); /* declare the array for later use */
           
          if(!isset($_POST['user_name']))
          {
              $errors[] = 'The username field must not be empty.';
          }
           
          if(!isset($_POST['user_pass']))
          {
              $errors[] = 'The password field must not be empty.';
          }
           
          if(!empty($errors)) /*check for an empty array, if there are errors, they're in this array (note the ! operator)*/
          {
              echo 'Uh-oh.. a couple of fields are not filled in correctly..';
              echo '&lt;ul&gt;';
              foreach($errors as $key =&gt; $value) /* walk through the array so all the errors get displayed */
              {
                  echo '&lt;li&gt;' . $value . '&lt;/li&gt;'; /* this generates a nice error list */
              }
              echo '&lt;/ul&gt;';
          }
          else
          {
              //the form has been posted without errors, so save it
              //notice the use of mysql_real_escape_string, keep everything safe!
              //also notice the sha1 function which hashes the password
              $sql = &quot;SELECT 
                          user_id,
                          user_name,
                          user_level
                      FROM
                          Users
                      WHERE
                          user_name = '&quot; . mysql_real_escape_string($_POST['user_name']) . &quot;'
                      AND
                          user_pass = '&quot; . sha1($_POST['user_pass']) . &quot;'&quot;;
                           
              $result = mysql_query($sql);
              if(!$result)
              {
                  //something went wrong, display the error
                  echo 'Something went wrong while signing in. Please try again later.';
                  //echo mysql_error(); //debugging purposes, uncomment when needed
              }
              else
              {
                  //the query was successfully executed, there are 2 possibilities
                  //1. the query returned data, the user can be signed in
                  //2. the query returned an empty result set, the credentials were wrong
                  if(mysql_num_rows($result) == 0)
                  {
                      echo 'You have supplied a wrong user/password combination. Please try again.';
                  }
                  else
                  {
                      //set the $_SESSION['signed_in'] variable to TRUE
                      $_SESSION['signed_in'] = true;
                       
                      //we also put the user_id and user_name values in the $_SESSION, so we can use it at various pages
                      while($row = mysql_fetch_assoc($result))
                      {
                          $_SESSION['user_id']    = $row['user_id'];
                          $_SESSION['user_name']  = $row['user_name'];
                          $_SESSION['user_level'] = $row['user_level'];
                      }
                      while ($row = mysql_fetch_array($result)) {
  //set the $_SESSION['signed_in'] variable to TRUE
  $_SESSION['signed_in'] = true;                  
  //we also put the user_id and user_name values in the $_SESSION, so we can use it at various pages
  while($row = mysql_fetch_assoc($result))
  {
      $_SESSION['user_id'] = $row['user_id'];
      $_SESSION['user_name'] = $row['user_name']; 
  }
                       }
                      echo '&lt;h3&gt;Welcome, ' . $_SESSION['user_name'] . '. &lt;a href=&quot;index.php&quot;&gt;Proceed to the forum overview&lt;/a&gt;.&lt;/h1&gt;';
                  }
              }
          }
      }
  }
  
  include 'footer.php';
  ?&gt;
  
  </code></pre>