Login form returning error!

Asked

Viewed 41 times

2

I have a login form that returns the following ERROR:

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 'as valor FROM olmp_cadparaprova WHERE email = 'cirillosales9' at line 1

Code:

$sql = "SELECT * senha_para_login as senha, as valor 
        FROM olmp_cadparaprova 
        WHERE email = '$_SESSION[email]'"; 

Does anyone know what it’s about?

  • Is missing the SELECT

  • Post your select to the question so we can help you better

  • Cirilo, the error occurred is due to your select command being incorrect, try to post the part of php code on which you mount it, the screen that requests the login data.

  • $sql = "SELECT * password_for_login the password, the value FROM olmp_cadparaprova WHERE email = '$_SESSION[email]'";

  • @Cirillowallison already manage to solve the problem?

  • I haven’t been able to

  • @Cirillowallison the after running my query still appears some error? the error is the same or different?

  • I cleaned the cash, error solved

  • @Cirillowallison if my answer helped you can accept it by clicking on the left side of it. If you need any more help let us know.

Show 4 more comments

2 answers

1

The error is in the choice of fields to show your query is poorly built, try changing SELECT * senha_para_login as senha, as valor, for SELECT *.

When using the * will return all table columns, complete example:

SELECT * FROM olmp_cadparaprova WHERE email='$_SESSION[email]'

If you want to show all rows of a table plus a specific column you can use the following example:

SELECT t1.coluna AS c1, t1.* FROM tabela AS t1 

End result according to your needs:

$sql = "SELECT t1.senha_para_login AS senha, t1.* 
        FROM olmp_cadparaprova AS t1 
        WHERE email = '$_SESSION[email]'";

0

Apparently, we’re missing the SELECT campos before the FROM olmp_cadparaprova WHERE email = 'cirillosales9'

Ex.:

SELECT campo FROM olmp_cadparaprova WHERE email = 'cirillosales9'

SELECT * FROM olmp_cadparaprova WHERE email = 'cirillosales9'

SELECT COUNT(*) FROM olmp_cadparaprova WHERE email = 'cirillosales9'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.