I think you need to change this condition .

 $result=$db-&gt;Qry($query);



  always return you query object


Just remove this condition and 

You need to count number of affected row

&lt;?php

public function selectRow($db, $tableName, $field, $where) {
    if ($where == "") {
        $query = "SELECT $field FROM $tableName";
    } else {
        $query = "SELECT $field FROM $tableName WHERE $where";
    }

    $result = $db-&gt;Qry($query);



    $no_of_rows = $db-&gt;TotRows($result);
    if ($no_of_rows == 1) {
        return $result;
    }
    if ($no_of_rows == 0) {
        return FALSE;
    }
    if ($no_of_rows &lt; 0) {
        die('Invalid query: ' . $sender . "(" . $query . "): " . mysql_errno() . ": " . mysql_error());
        return FALSE;
    }
}


php mysql return wrong boolean result
I'd like to generate RSA-SHA1 signatures with the RSA-Sign JavaScript Library. Specifically, I'd like to use this for signing OAuth requests.

However, the signature generated by the JavaScript library looks different to the one I can generate e.g. with

$ echo -n "x" | openssl dgst -sha1 -sign priv.key -binary | openssl base64 | xargs echo -n
eV0ZrD7ZrTsuzHHYSwLfUJhXuM96D6ZyIzD5FFphzHbKRaO4TMeTR7bJjkuPib+l
EccM7t6YNDvRgOHyXJDVZZQTg5G4D4jnGVmOgeuti1etCCpLsb1Rl3sfJF/rIlgA
AmejvBbrEG+n8L+GeD6Vd3cneW7k2Rksnh+/BWnnR3c=


In contrast: This is what the library generates (base64 encoded):

Nzk1ZDE5YWMzZWQ5YWQzYjJlY2M3MWQ4NGIwMmRmNTA5ODU3YjhjZjdhMGZhNjcy
MjMzMGY5MTQ1YTYxY2M3Ng0KY2E0NWEzYjg0Y2M3OTM0N2I2Yzk4ZTRiOGY4OWJm
YTUxMWM3MGNlZWRlOTgzNDNiZDE4MGUxZjI1YzkwZDU2NQ0KOTQxMzgzOTFiODBm
ODhlNzE5NTk4ZTgxZWJhZDhiNTdhZDA4MmE0YmIxYmQ1MTk3N2IxZjI0NWZlYjIy
NTgwMA0KMDI2N2EzYmMxNmViMTA2ZmE3ZjBiZjg2NzgzZTk1Nzc3NzI3Nzk2ZWU0
ZDkxOTJjOWUxZmJmMDU2OWU3NDc3Nw==


(assuming the same input &amp; key, of course)

Is it possible that this is because of the SHA1 implementation being used? In that case, I could try to use another one.

I'm no expert of cryptography, but the OAuth RFC 5849 is saying that RSASSA-PKCS1-V1_5-SIGN needs to be used, which seems to be the case for the library.

Thank you very much.
