Hey everyone,

I have a page where a person enters an order number to check if it is processed. The php checks the table for the ordernumber and then checks the corresponding "processed" column where I have a boolean 1 or 0.

Im having trouble returning the boolean and passing it through an if-else statement.
I then want to output "Processed" if 1 and "Not Processed" if 0.

At this point, any order number I enter returns a "Processed" value.
I know the issue is getting the query result and passing it through the if-else.

Any help would be greatly appreciated, thanks!

PHP Code:
<?php 
if(isset($_POST['checktrans'])) {

$db mysql_connect("mysql.xxxxxxx.com","xxxxxxx","xxxxxxxxx");
   if(!
$db) die("Error connecting to MySQL database.");
   
mysql_select_db("xxxxxxxx" ,$db);

    
$check $_POST['checktrans'];
  
//don't need LIMIT 1 as the ID should be unique (auto-incremented)
  
$sql "SELECT `process` FROM `bits` WHERE `ordernumber` = $check";
  
mysql_query($sql) or die(mysql_error());
  
  
$result mysql_query($sql);
  
  
  if (
mysql_free_result($result) == 1) {
      echo 
"PROCESSED";
  } elseif (
mysql_free_result($result) == 0) {
      echo 
"NOT PROCESSED";
  }
}


?>