$u = mysql_real_escape_string($_POST["username"]);
$p = sha1($_POST["passwd"]);
$q = "SELECT * FROM profile WHERE email=`$u` AND passwd=`$p`";
$run = mysql_query($q);
  if(!$run){
    echo mysql_error();
  }

this creates Unknown column 'mymail@gmail.com' in 'where clause' error. This code is from a tutorial and a piece of a submit-new-post php page.

$q = "SELECT * FROM profile WHERE email=`$u` AND passwd=`$p`";

replace it with

$q = "SELECT * FROM profile WHERE email='$u' AND passwd='$p'";

Thanks ckchaudhary, it solved the problem.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.