Jump to content

mysqli prepared statement


gmc1103

Recommended Posts

Hi

 

I'm testing a query, this one

SELECT COUNT(sala_ocupacao.`id_dia`) AS ocup FROM sala_ocupacao WHERE sala_ocupacao.`id_dia` = 1 AND sala_ocupacao.`id_sala`= 1

and the return is 17

 

When i use the prepared statement in php file 

$stmt = $mysqli->prepare("SELECT COUNT(sala_ocupacao.`id_dia`) FROM sala_ocupacao WHERE sala_ocupacao.`id_dia` = ? AND sala_ocupacao.`id_sala`= ? ");
$stmt->bind_param('ss', $dia, $sala);
$existe = $stmt->execute();
if ($existe != 0) {
    echo "Values found";
}

The $existe variable gives me 1...and boolean...is normal?

 

Regards

Link to comment
https://forums.phpfreaks.com/topic/295982-mysqli-prepared-statement/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.