How to pass an array value in bind_param in mysqli? [duplicate]

0

I'm doing this, but always the error because of the array, does anyone know how to solve this:

public function Verificar(string $tabela,string $parametros,array ...$usuario) {
            $this->Query = $this->Conexao->prepare("SELECT * FROM usuarios WHERE $tabela");
            $this->Query->bind_param($parametros,$usuario);
            $this->Query->execute();
            $this->ResultadoUser = $this->Query->get_result();
            return $this->ResultadoUser;
        }
    
asked by anonymous 01.08.2016 / 20:44

1 answer

0

If the solution proposed in the comment by rray does not help, you might consider using a framework. I recommend, use, or Pixie . Here is an example of SELECT:

$query = QB::table('my_table')->where('nome', 'Jose');
$query->count();

It may not be the answer you expect, but it's an option to consider. To do what you want to pass several parameters at the same time you can pass in the format expected by Pixie.

See the documentation with several examples.

    
01.08.2016 / 21:05