<分区>
Possible Duplicate:
php warning mysql_fetch_assoc
我只是在我的网站上实现一个简单的部分,它只是从 header (subid)中获取一个变量,用数据库检查它,然后输出与该变量相关的其他字段。
但是我收到这个错误 -
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/admin/public_html/report.php on line 14
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''/home/admin/public_html/log/log_274b43e6ad_New Text Document (7).txt.txt' at line 1
这是我的页面的代码,可以完成这一切
include 'connect_to_mysql.php'; $sql_header = mysql_query("SELECT * FROM system"); $header_array = mysql_fetch_assoc($sql_header); $total_scans = $header_array['total_scans']; $malware_detected = $header_array['malware_detected']; $total_users = $header_array['total_users']; $report_id = $_GET['log']; var_dump($report_id); $sql_report = mysql_query("SELECT * FROM logs WHERE log_name='$report_id"); var_dump($sql_report); $report_array = mysql_fetch_assoc($sql_report) or die(mysql_error()); $file_name = $report_array['file_name']; $file_size = $report_array['file_size']; $submission_date = $report_array['submission_date']; $result = $report_array['result']; $status = $report_array['status'];
有什么可能出错的想法吗?我已经尝试了一切并检查了我的数据库,所有的名称都是正确的,我什至检查了数据库中的 $report_id 变量并且它匹配,所以我不确定为什么它会出错。
感谢帮助