我只是想让一些基本的东西现在出现,并且不起作用。它应该在屏幕上显示1。我的逻辑错了吗?我将声明粘贴到控制台中并得到1。
<?php
$sql = mysqli_query("Select moist_measure_avail from sigh_in_account where moist_measure_avail = '1'");
$result = mysqli_fetch_array($sql);
echo $result['moist_measure_avail'];
答案 0 :(得分:0)
$sql = mysqli_query("Select moist_measure_avail from sigh_in_account where moist_measure_avail = '1'");
将连接作为上述方法中的第一个参数。像这样
$sql = mysqli_query($conn,"Select moist_measure_avail from sigh_in_account where moist_measure_avail = '1'");
其中$ conn是mysql连接
答案 1 :(得分:0)
首先您必须创建一个连接
<?php
$conn = mysqli_connect("localhost "," root","","dbname");
?>
然后您必须在查询中包含conn变量
$sql = mysqli_query( $conn, " SELECT moist_measure_avail from sigh_in_account WHERE moist_measure_avail = '1'");
sql语句必须全部大写或全部全部小写