Login form returning error!

2

I have a login form that returns the following ERROR :

  

You have an error in your SQL syntax; check the manual that   correspond to your MySQL server version for the right syntax to use   near 'as value 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 this is about?

    
asked by anonymous 30.10.2017 / 11:22

2 answers

1

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

Using * will return all the columns of the table, complete example:

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

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

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

Final result according to your needs:

$sql = "SELECT t1.senha_para_login AS senha, t1.* 
        FROM olmp_cadparaprova AS t1 
        WHERE email = '$_SESSION[email]'";
    
30.10.2017 / 12:08
0

It seems that SELECT campos is missing before 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'

    
30.10.2017 / 11:25