 <p>You didn't set a variable <code>$query3</code>.</p> <pre><code>$connection = mysql_connect("localhost", "root", ""); $db = mysql_select_db("testproject", $connection); $query1 = mysql_query("SELECT * FROM mentors where username='$username'",$connection); $query2 = mysql_query("SELECT * FROM students where username='$username'",$connection); $query3 = mysql_query("SELECT * FROM admin where username='$username'",$connection); ..... </code></pre>