MySQL Forums
Forum List  »  Newbie

Re: sha1 function in MySql query.
Posted by: Peter Brawley
Date: September 08, 2021 03:45PM

> $strLogin = "INSERT INTO t (username, password) VALUES ('$username', sha1('$password'))";

That just assigns a string, you have to call the query func eg

$conn = mysqli_connect( ... );
if( $conn->!query($srlogin) ) exit( $conn->error );

$query = "SELECT username, password FROM t WHERE username = '$user' AND password = sha1('$password')";

Again you need to call query() eg ...

if( !$res=$conn->query($query) ) exit( $conn->error );
if( $row=$res->fetch() ) ...

Options: ReplyQuote


Subject
Written By
Posted
September 07, 2021 03:20PM
Re: sha1 function in MySql query.
September 08, 2021 03:45PM
September 08, 2021 04:33AM


Sorry, you can't reply to this topic. It has been closed.

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.