我只是執行我的網站的一個簡單的一部分,只是需要一個變量從頭部(子編號),與數據庫檢查它然後輸出與變量相關的其他字段。
但是我得到這個錯誤 -
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變量,它匹配,所以我不知道它爲什麼會得到一個錯誤。
感謝您的幫助
只需爲var_dumps添加我獲取的字符串(72)「/ home/admin/public_html/log/log_274b43e6ad_New Text Document(7).txt.txt」爲$ report_id和我越來越 - 布爾(假)爲$ sql_report。如果有幫助,再次感謝 – Arken 2012-01-08 17:24:05