Is this code correct

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • tharindu96
    New Member
    • Jan 2012
    • 16

    Is this code correct

    can someone tell me if this code is correct i'm getting "not".
    Code:
    $query = "SELECT `id` FROM `users` WHERE `username`='$username' AND `password`='$passhash'";
    	if($query_run = mysql_query($query)) {
    			echo 'ok.';
    		}else{
    			echo 'not.';	
    		}
  • Rabbit
    Recognized Expert MVP
    • Jan 2007
    • 12517

    #2
    = is the assignment operator, == is the comparison operator.

    Comment

    • Dormilich
      Recognized Expert Expert
      • Aug 2008
      • 8694

      #3
      if there is a mysql error you can get it with mysql_error().

      Comment

      Working...