php - Always executes else clause even if value present in database -


    $sql="select * manifest (awb_no = '$var')";     $result=mysql_query($sql);       if($result==$var)     {      echo "tracking id present in manifest</br>";     }      else     {       echo "trackingid not present<br>";       exit(0);     } 

when retrieve data database , check against data have entered,even though data entered correct , present in database executes else clause.where going wrong? please help!

try count rows query try this:

$sql = "select * manifest (awb_no = '$var')"; $result = mysql_query($sql);   if(mysql_num_rows($result) > 0) {     echo "tracking id present in manifest</br>"; } else {     echo "trackingid not present<br>";     exit(0); } 

btw mysql depricated use pdo or mysqli


Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -