我的代码有什么错误。它说"
致命错误:函数名称必须是第27行"
中C:\ wamp \ www \ Unnamed Site 2 \ admin_area \ view_prod.php中的字符串
<?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 } ?>
答案 0 :(得分:4)
更改以下行中的括号:
$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'];
因为数组标识符必须放在方括号中。