 <p>You have error in your query, you are writing <code>select*</code> but there should be a space like so <code>select *</code></p> <p><code>$sql = mysql_query("select * from login where user= '$user' AND pass='$pass' LIMIT 3 ") or die(mysql_error());</code></p> <p><strong>EDIT</strong></p> <p>Also YOU MUST HAVE TO PUT <code>session_start();</code> as the first line of your code... else it would not work.</p> <p>So make this as your first lines of code</p> <pre><code>session_start(); error_reporting(E_ALL); // to see if there is error in code </code></pre> <p>And also PHP varialble names are <a href="http://php.net/manual/en/language.variables.basics.php" rel="nofollow">case-sensitive</a>, </p> <blockquote> <p>Variables in PHP are represented by a dollar sign followed by the name of the variable. <strong>The variable name is case-sensitive</strong>.</p> </blockquote> <p>So please change</p> <pre><code>if($user==$username &amp;&amp; $pass==$password) </code></pre> <p>to </p> <pre><code>if($user==$UserName &amp;&amp; $pass==$Password) </code></pre>