Recieving an "invalid login" when attempting to login using php and mysql
<p>I have viewed many sites compared various login scripts and can't find any solution. I put in the correct info and get an 'invalid login' also if i don't put anything in there i get an 'invalid login'. I could really use some help to troubleshoot. Here is the code</p>

<pre><code>&lt;?php 
  include_once ('dbc.php');

  $user_email = mysql_real_escape_string(isset($_POST['email']));

  if (isset($_POST['Submit'])=='Login')
  {
    $md5pass = md5($_POST['pwd']);
    $sql = "SELECT id,user_email FROM users WHERE 
              user_email = '$user_email' AND 
              user_pwd = '$md5pass' AND user_activated='1'"; 

    $result = mysql_query($sql) or die (mysql_error()); 
    $num = mysql_num_rows($result);

    if ( $num = 0 ) 
    { 
      // A matching row was found - the user is authenticated. 
      session_start(); 
      list($user_id,$user_email) = mysql_fetch_row($result);
      // this sets variables in the session 
      $_SESSION['user']= $user_email;  

      if (isset($_GET['ret']) &amp;&amp; !empty($_GET['ret']))
      {
        header("Location: $_GET[ret]");
      } else {
        header("Location: myaccount.php");
      }

      //echo "Logged in...";
      exit();
    } 

    header("Location: login.php?msg=Invalid Login");
    //echo "Error:";
    exit;       
  }
?&gt;
</code></pre>

<p>Form Code----</p>

<pre><code>&lt;td bgcolor="#e5ecf9" class="mnubody"&gt;&lt;form name="form1" method="post" action=""&gt;
    &lt;p&gt;&amp;nbsp;&lt;/p&gt;
    &lt;p align="center"&gt;Your Email: 
      &lt;input name="email" type="text" id="email"&gt;
    &lt;/p&gt;
    &lt;p align="center"&gt; Password: 
      &lt;input name="pwd" type="password" id="pwd"&gt;
    &lt;/p&gt;
    &lt;p align="center"&gt; 
      &lt;input type="submit" name="Submit" value="Login"&gt;
    &lt;/p&gt;
    &lt;p align="center"&gt;&lt;a href="register.php"&gt;Register&lt;/a&gt; | &lt;a href="forgot.php"&gt;Forgot&lt;/a&gt;&lt;/p&gt;
  &lt;/form&gt;&lt;/td&gt;
</code></pre>
