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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.