从mysqli_query返回的条件不满足

时间:2019-05-23 12:07:56

标签: php mysql mysqli

如果表总余额中的total_money,我应该完成以下条件 大于10才能显示确切的用户消息,但不起作用

任何语法或逻辑错误? 该怎么解决?

 <?php
     $db = mysqli_connect('localhost', '********', '**********', '*********');

      $user_check_query =  "SELECT total_money FROM total_balance WHERE username = '" . $_SESSION['username'] . "' ";
    $result = mysqli_query($db, $user_check_query);
      $row = mysqli_fetch_array($result);

      if($result >10){
          echo "Enough";
        } else {
            echo "Not Enough Money";
      }
      ?> 

表: total_balance

 ID   username        total_money
+----+--------------+---------------+
|1   | John         |  100          |
+----+--------------+---------------+
|2   | Alex         |  10           |
+----+--------------+---------------+
|3   | Pani         |  5            |
+----+--------------+---------------+

1 个答案:

答案 0 :(得分:0)

更改

.then((res) => {
console.log("Axios post is working")
console.log("Something: " + res);
console.log(res.data);
})

if($result >10){
          echo "Enough";
        } else {
            echo "Not Enough Money";
      }