gpt4 book ai didi

php - MYSQL 上的错误它说 fatal error

转载 作者:太空宇宙 更新时间:2023-11-03 10:40:14 25 4
gpt4 key购买 nike

我的代码有什么错误。它说“

Fatal error: Function name must be a string in C:\wamp\www\Unnamed Site 2\admin_area\view_prod.php on line 27"

<?php

$con = mysqli_connect("localhost","root","","dbname");

$get_prod = "select * from products";

$query_prod = mysqli_query($con,$get_prod);

$i = 0;
while($row_pro = mysqli_fetch_array($query_prod)){
$prod_id = $row_pro('prod_id');
$prod_name = $row_pro('prod_name');
$prod_price = $row_pro('prod_price');
$prod_image = $row_pro('prod_image');
$i++;



?>
<tr>

<td><?php echo $prod_id; ?></td> /*this is line 27/*
<td><?php echo $prod_name; ?></td>
<td><?php echo $prod_image; ?></td>
<td><?php echo $prod_price; ?></td>
<td><a href ="index.php?edit_prod">Edit</a></td>
<td><a href ="delete_prod.php">Delete</a></td>


</tr>

<?php } ?>

最佳答案

更改以下行中的括号:

$prod_id = $row_pro('prod_id');
$prod_name = $row_pro('prod_name');
$prod_price = $row_pro('prod_price');
$prod_image = $row_pro('prod_image');

括号

$prod_id = $row_pro['prod_id'];
$prod_name = $row_pro['prod_name'];
$prod_price = $row_pro['prod_price'];
$prod_image = $row_pro['prod_image'];

因为数组标识符必须在方括号中。

关于php - MYSQL 上的错误它说 fatal error ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39858817/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com