MySQL Forums
Forum List  »  PHP

Re: Mysql Query with field name and custom value to compare
Posted by: Rohit Seth
Date: December 11, 2020 01:41AM

We are basically connecting one software done by someone else to our script.

That software have predefined key which is added with account number to generate SHA 1 hash.

When that software is opened, it tries to connect to our web api to authenticate and we need to match the following case

$customvalue=123456;
$hash coming as '3dc379b20a51fa4966d9ee28f2ea5c8e98ebf3b8'

so in php we are executing this query

$rs=dbquery("select Username,extra1 from users where sha1(extra1.$customvalue)='$hash'");

but it is not able to match as extra1 field and $customvalue combination is not getting combined.
We don't want to fetch the entire database and then just compare it.

In our database extra1 field for a user is stored like
extra1 = abc123

Options: ReplyQuote


Subject
Written By
Posted
Re: Mysql Query with field name and custom value to compare
December 11, 2020 01:41AM


Sorry, only registered users may post in this forum.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.