exclude column of select *

Asked

Viewed 668 times

2

I have an api that returns the data of the user in json, but wanted to return all data except the password, would it have any way without being select in all fields except the password? I’m doing so currently:

    if ($autenticado) {
    $resultado = $sql->select("SELECT * FROM tb_alunos WHERE email = :EMAIL LIMIT 1",array(
        ":EMAIL"=>$usermail[0]
    ));
    $response = json_encode($resultado);
}else{
    return $response->withStatus(401);
}
  • No, either send them all or specify each one.

  • You can tell us which is the database manager? Oracle Database, mariaDB, Postgresql etc..

  • to using mysql

1 answer

1

If you don’t want only one column to appear you have to select with the name of all the others except the column you don’t want, you can’t do a "select *" minus a specific column but add only the columns you want.

Browser other questions tagged

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