jeudi 24 novembre 2016

False value in sql query in php function only works in quotationmarks

I have to develop an appStore plugin and one query isn't working right.

the function

function addItem($installed){...

adds shop items(some html stuff) trough an echo into a div

<div class="flexRow order2 topLine">
    <?php 
       addItem("false");
    ?>
</div>

and

<div class="flexRow order2 topLine">
   <?php 
       addItem(true);
    ?>
</div>

the query for the data selection is the following:

$sql = "SELECT * FROM shopitems Where installed = ". $installed ;

My question: As you see the false boolean value is in quotationmarks. Otherwise it won't work. The truestatement could be in quotationmarks or not. Is something wrong my query?

The column "installed" is from boolean value.

The warning php shows on Site is the following:

mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in C:\xampp\htdocs\setupItems.php on line 31

0 results

Line 31 till 33:

if (mysqli_num_rows($result) > 0) {
    // output data of each row
    while($row = mysqli_fetch_assoc($result)) {




Aucun commentaire:

Enregistrer un commentaire