1
Error while executing function PASSWORD
IN MYSQL SERVE
I have the following query:
SELECT *
FROM users
WHERE login = 'FABIO'
AND pwd = PASSWORD('2018')
LIMIT 0, 50000
You’re making that mistake:
Error Code: 1064. You have an error in your SQL syntax; check the manual that Corresponds to your Mysql server version for the right syntax to use near
See what FABIO is between simple quotes, password also has to be also.
– Reginaldo Rigo
@The password and function cannot be enclosed in a single quote. The query is correct.
– Fabio C
Fabio, when you said that the password has to be in simple quotes was a tip. The query that is coming into the bank is not correct. You have to write something like this: "SELECT * from usuarios Where login = 'FABIO' and pwd = '" + PASSWORD('2018') + "' LIMIT 0, 50000 " so that the query that arrives at the bank arrives correctly.
– Reginaldo Rigo
@In this case, concatenation is not necessary since the function is native to Mysql. I think it would be some kind of wrong configuration on my Mysql Server, because on another server a query identical to this one works and brings the correct result.
– Fabio C
Let’s say the PASSWORD function is returning 123. Do the select like this: SELECT * from usuarios Where login = 'FABIO' and pwd = '123' LIMIT 0, 50000
– Reginaldo Rigo
@Reginaldo works there behind the results. The problem is when I put the PASSWORD function.
– Fabio C
You have to mount your select so that you put the quotes in the return of the function. Or make the function already return the value between quotes.
– Reginaldo Rigo
@Reginaldorigo as reported earlier, in this case, concatenation is not necessary since the function is native to Mysql. I think it would be some kind of wrong configuration on my Mysql Server, because on another server a query identical to this one works and brings the correct result.
– Fabio C
@Reginaldorigo after a look at Guilherme’s reply.
– Fabio C