New Ribbon
Canva+AI創意設計與品牌應用250招:從商業技巧、社群祕技到AI圖文影音特效 快快樂樂學威力導演2024.影音剪輯與AI精彩創作 文淵閣工作室祝福大家新年快樂.龍年吉祥 Power Automate自動化超效率工作術 Midjourney AI圖像魔導書:搭配ChatGPT魔法加倍 超人氣FB+IG+LINE社群經營與行銷力(第二版) 翻倍效率工作術:不會就太可惜的 Excel × ChatGPT 自動化應用 AppInventor2零基礎入門班中文版(第六版) Python零基礎入門班(第四版) C語言學習聖經 用Canva設計超快超質感:平面、網頁、電子書、簡報、影片製作與AI繪圖最速技 PHP8/MySQL網頁程式設計自學聖經 翻倍效率工作術 - 不會就太可惜的Power BI大數據視覺圖表設計與分析(第三版) 社群經營一定要會的影音剪輯與動畫製作術 Notion高效管理250招:筆記×資料庫×團隊協作,數位生活與工作最佳幫手 Office 2021高效實用範例必修16課(附500分鐘影音教學/範例檔) Excel自學聖經(第二版):從完整入門到職場活用的技巧與實例大全 網路開店×拍賣王:蝦皮來了(第二版) 專家都在用的Google最強實戰:表單、文件、試算、簡報、遠距與線上會議 超人氣 Instagram 視覺行銷力(第二版):小編不敗,經營 IG 品牌人氣王的 120 個秘技!

 

  使用網路留言板範例時出現錯誤?

李羿辰

李羿辰
更新時間:2011/3/12 上午 09:54:20

 


使用《PHP5/MySQL程式設計樂活學》書上的網路留言板範例時出現以下錯誤:
1.訪客留言送出時 Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\post.php on line 15

2.登入管理送出時 Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\login.php on line 20

3.使用預設帳號密碼admia成功登入時 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\admin.php on line 4

4.修改訪客留言時 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\adminfix.php on line 4

5.更新訪客留言時 Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\adminfix.php on line 26

6.刪除訪客留言時 Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\admindel.php on line 4

7.刪除訪客留言送出時 Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\admindel.php on line 19

8.登出管理時 Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\admindel.php on line 7

Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\phpboard\connMysql.php:1) in C:\AppServ\www\phpboard\admindel.php on line 12

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\phpboard\admindel.php on line 23

以上,請問該如何解決?我看板上有人發問時你們是說header()前不能有空白,我開起來看是沒有,不能有Html輸出,這是什麼意思?我是完全照Copy你們書上的設定及光碟資料,還會出錯嗎?

文淵閣工作室

文淵閣工作室
更新時間:2013/2/22 上午 08:24:33

 

如果您是書上的範例,您可以將您所練習的檔案整個資料夾壓縮(含資料庫),寄來給我們看看。記得來信要詳述錯誤內容。
請注意根據公司的規定,一定要是書上的範例,敬請配合。

包四維

包四維
更新時間:2013/2/22 下午 04:26:03

 

除了該錯誤訊息之外,這邊應該是你語法寫錯了
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\AppServ\www\phpboard\admindel.php on line 23

剩下的錯誤訊息
請開啟php.ini
通常該檔案在c:/windows之下
找output_buffering字串
將該字串的值修改成On或是4096即可

sam

sam
更新時間:2013/3/3 下午 12:06:41

 

請問在程式樂活學的範例中,
所有檢查$_SESSION的頁面都是先連結資料庫後才檢查$_SESSION是否存在:
header("Content-Type: text/html; charset=utf-8");
require_once("connMysql.php");
session_start();

只有2個login.php的頁面是先檢查$_SESSION後才require_once("connMysql.php");
請問這是有特別意義才要這樣寫嗎?
還是2種方式都可以呢?
謝謝!

文淵閣工作室

文淵閣工作室
更新時間:2013/3/4 上午 08:32:22

 

require_once("connMysql.php");
是為了要連結資料庫。
session_start();
是為了要啟動Session的使用。
在這個範例中,並沒有先後的考量,
所以先後放置是沒有關係的。