php - 函数名必须是字符串。无法使用行显示数据库中的数据

标签 php database function

这是我的事件编码。我希望它在我的系统中显示事件属性。错误显示为

Fatal error: Function name must be a string in D:\XAMPP\htdocs\system\bulletin.php

函数名必须是字符串是什么意思? 错误在哪里?我应该更改哪一行?

<th scope="col"><center><strong>Event ID</strong></center></th>
<th scope="col"><center><strong>Event</strong></center></th>
<th scope="col"><center><strong>Description of the Event</strong></center></th>

<?php
require 'database.php';

$qry = "SELECT * FROM bulletin ORDER BY event_id DESC";
$result = mysql_query($qry) OR die (mysql_error());

while($row = mysql_fetch_assoc($result())){
$event_id = $row['event_id'];
$event = $row['event'];
$venue = $row['venue'];
$daydropdown_start = $row['day1'];
$monthdropdown_start = $row['month1'];
$yeardropdown_start = $row['year1'];
}


<td><? echo $row['event_id']; ?></td>
<td><? echo $row['event']; ?></td>
<td><br>Venue:<?php echo $row['venue']; ?></br>
<br>  Date: <?php echo $row['day1'] / $row['month1'] / $row['year1']; ?> </br></td>

最佳答案

我猜你的错误是在这一行 while($row = mysql_fetch_assoc($result())){

$result 不是一个函数,而是一个变量。改成

while($row = mysql_fetch_assoc($result)){,你应该很好

关于php - 函数名必须是字符串。无法使用行显示数据库中的数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20460820/

相关文章:

php - 为什么我的 MySQL 全文搜索不起作用?

php - 如何在 PHP 中用单个标点符号替换所有重复的标点符号?

javascript - fetch 不发送自动填充的输入

php - 尝试显示存储在数据库中的图像时损坏的 img 链接

sql - 在单个 PostgreSQL 查询中多次调用 `now()` 是否总是会给出相同的结果?

r - 如何在第一次看到特定观察后删除行

php - 具有多个 Poules 的 SQL 锦标赛表

c - 基于CLRS教科书的归并排序

C++程序计算最大公约数

function - 如何减少 Golang 中重复函数的冗余代码?