简体   繁体   English

运行我的购物车页面时,出现 mysqli_fetch_array() expects parameter 1 to be mysqli_result 错误

[英]While running my shopping cart page, i get mysqli_fetch_array() expects parameter 1 to be mysqli_result error

while running the code im getting tis error: mysqli_fetch_array() expects parameter 1 to be mysqli_result error运行代码时出现错误:mysqli_fetch_array() expects parameter 1 to be mysqli_result error


$result = mysqli_query($dbc,"select * from 'product'");
while($row = mysqli_fetch_assoc($result)){
        echo "<div class='product_wrapper'>
              <form method='post' action=''>
              <input type='hidden' name='cat' value=".$row['Product_Category']." />
              <div class='image'><img src='".$row['Product_Img']."' /></div>
              <div class='name'>".$row['Product_Name']."</div>
              <div class='price'>$".$row['Product_Price']."</div>
              <button type='submit' class='buy'>Buy Now</button>
              </form>
              </div>";
        }
mysqli_close($dbc);

Below is the working example on my laptop using xampp,下面是在我的笔记本电脑上使用 xampp 的工作示例,

<?php 
$dbc = mysqli_connect('localhost', 'USERNAME', 'PASSWORD', 'TABLE_NAME');
if (mysqli_connect_errno()) {
  echo "Failed to connect to MySQL: " . mysqli_connect_error();
  exit();
}
$result = mysqli_query($dbc, "select * from product");
while($row = mysqli_fetch_assoc($result)){
        echo "<div class='product_wrapper'>
              <form method='post' action=''>
              <input type='hidden' name='cat' value=".$row['Product_Category']." />
              <div class='image'><img src='".$row['Product_Img']."' /></div>
              <div class='name'>".$row['Product_Name']."</div>
              <div class='price'>$".$row['Product_Price']."</div>
              <button type='submit' class='buy'>Buy Now</button>
              </form>
              </div>";
        }
mysqli_close($dbc);
?>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 mysqli_fetch_array&row期望参数1为mysqli_result - mysqli_fetch_array & row expects parameter 1 to be mysqli_result mysqli_fetch_array()的问题期望参数1为mysqli_result - Problems with mysqli_fetch_array() expects parameter 1 to be mysqli_result 错误mysqli_fetch_array()预计参数1是mysqli_result,给定的字符串 - error mysqli_fetch_array() expects parameter 1 to be mysqli_result, string given mysqli_fetch_array()错误期望参数1为mysqli_result,布尔值 - mysqli_fetch_array() error expects parameter 1 to be mysqli_result, boolean 收到错误消息:警告:mysqli_fetch_array()期望参数1为mysqli_result,布尔值在 - Getting error: Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in 警告:当我有2个参数时,mysqli_fetch_array()期望参数1为mysqli_result - Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result when I have 2 parameters 我在 EDIT.php 和 Update.php 中的这一部分出现错误 mysqli_fetch_array() 期望参数 1 为 mysqli_result - I am getting error at this part in EDIT.php and Update.php mysqli_fetch_array() expects parameter 1 to be mysqli_result 得到一个奇怪的结果:mysqli_fetch_array()期望参数1是mysqli_result - Getting an odd result: mysqli_fetch_array() expects parameter 1 to be mysqli_result mysqli_fetch_array()期望参数1为mysqli_result,给出PHP论坛尝试的数组 - mysqli_fetch_array() expects parameter 1 to be mysqli_result, array given PHP forum attempt 警告:mysqli_fetch_array() 期望参数 1 是 mysqli_result,给定的数组 - Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, array given
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM