bankker6480
สมุนแก๊งเสียว
พลังน้ำใจ: 162
ออฟไลน์
กระทู้: 710
|
 |
« เมื่อ: 17 มกราคม 2013, 01:47:49 » |
|
มันขึ้นแบบนี้ครับ Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/postfree/domains/bank-network.info/public_html/ViewProduct.php:1) in /home/postfree/domains/bank-network.info/public_html/auth.php on line 3
จะแก้ยังไงดีครับ
|
|
« แก้ไขครั้งสุดท้าย: 17 มกราคม 2013, 01:48:31 โดย bankker6480 »
|
บันทึกการเข้า
|
|
|
|
dekmv
เจ้าพ่อบอร์ดเสียว
พลังน้ำใจ: 222
ออฟไลน์
กระทู้: 3,264
|
 |
« ตอบ #1 เมื่อ: 17 มกราคม 2013, 01:49:01 » |
|
งงเลย ... รออ่านนะครับ ... อยากรู้ครับๆ
|
|
|
บันทึกการเข้า
|
|
|
|
adjobb
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 320
ออฟไลน์
กระทู้: 2,874
|
 |
« ตอบ #2 เมื่อ: 17 มกราคม 2013, 02:14:06 » |
|
ลองเอาโค้ดมาด้วยครับ เพื่อเพื่อนๆจะได้ช่วยแก้
|
|
|
บันทึกการเข้า
|
|
|
|
navico
Verified Seller
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 108
ออฟไลน์
กระทู้: 2,315
|
 |
« ตอบ #3 เมื่อ: 17 มกราคม 2013, 02:16:08 » |
|
ลองดูว่า session_start(); อยู่บรรทัดแรกหรือเปล่าครับ ถ้าไม่ก็ ทำให้อยู่บรรทัดแรกครับ
|
|
|
บันทึกการเข้า
|
|
|
|
EntServ
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 367
ออฟไลน์
กระทู้: 1,366
|
 |
« ตอบ #4 เมื่อ: 17 มกราคม 2013, 07:59:18 » |
|
เปลี่ยน file Encoding เป็น UTF-8 Without BOM 
|
|
|
บันทึกการเข้า
|
รับทำระบบ Streaming Server อยากได้เว็บสตรีมมิ่งหล่อๆ ติดต่อ PM ครับ
|
|
|
rokaisakkon
ก๊วนเสียว
พลังน้ำใจ: 38
ออฟไลน์
กระทู้: 459
|
 |
« ตอบ #5 เมื่อ: 17 มกราคม 2013, 08:02:22 » |
|
เปลี่ยน file Encoding เป็น UTF-8 Without BOM  เสริมให้ ใช้โปรแกรม Notepad++ แก้ไขนะครับ
|
|
|
บันทึกการเข้า
|
#วงการฟรีแลนซ์มันโหดน่ะครับ
|
|
|
xvlnw.com
Verified Seller
เจ้าพ่อบอร์ดเสียว
พลังน้ำใจ: 493
ออฟไลน์
กระทู้: 5,905
|
 |
« ตอบ #6 เมื่อ: 17 มกราคม 2013, 08:56:13 » |
|
มันมีไฟล์ สองไฟล ที่เปิด start secession ซ้อนกันครับ เอาออกซะอัน หรือไม่ก็ ใน config php มันอืม ปิด secesion อะไรทำนองเนี่ยครับลองดู
ตามนี้ครับ มี 2 ที่หรือมากกว่า ส่วนการแก้ไขก็สร้าง config ที่เป็น php แล้วประกาศ session_start(); ไว้บนสุด วิธีใช้งานคือ ให้ include ไปไว้บนสุดของไฟล์ครับ
|
|
|
บันทึกการเข้า
|
|
|
|
mean
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 121
ออฟไลน์
กระทู้: 1,009
|
 |
« ตอบ #7 เมื่อ: 17 มกราคม 2013, 09:34:31 » |
|
จริงๆ สาเหตุมาจาก มีการ print screen ก่อนการประกาศใช้ function header ครับ เช่น มีการสั่ง echo , print , หรือ มีช่องว่าง enter line , space ท้ายบรรทัด
เช่น ไฟล์ a.php <?
?> ----- ช่องว่าง
ไฟล์ b.php <? include a.php header('...'); ?>
หรืออีกกรณีคือ <? echo 1; header(...); ?>
ไล่แก้โดย หา function header และ ไล่ย้อนดูครับ public_html/auth.php on line 3
|
|
« แก้ไขครั้งสุดท้าย: 17 มกราคม 2013, 09:35:19 โดย mean »
|
บันทึกการเข้า
|
|
|
|
bankker6480
สมุนแก๊งเสียว
พลังน้ำใจ: 162
ออฟไลน์
กระทู้: 710
|
 |
« ตอบ #8 เมื่อ: 17 มกราคม 2013, 11:53:25 » |
|
ในไฟล์ auth.php<?php //Start session session_start(); //Check whether the session variable SESS_MEMBER_ID is present or not if(!isset($_SESSION['SESS_MEMBER_ID']) || (trim($_SESSION['SESS_MEMBER_ID']) == '')) { header("location: access-denied.php"); exit(); } ?> เวลาเอา auth.php ไปใช้ก็เอาโค้ดนี้ไปไว้บนสุดของไฟล์ที่จะเข้าระบบอ่ะครับ <?php require_once('auth.php'); ?> และผมมีไฟล์ 2 ไฟล์ config.inc.php กับ config.php
|
|
« แก้ไขครั้งสุดท้าย: 17 มกราคม 2013, 11:54:20 โดย bankker6480 »
|
บันทึกการเข้า
|
|
|
|
Kusumoto
สมุนแก๊งเสียว
พลังน้ำใจ: 42
ออฟไลน์
กระทู้: 551
|
 |
« ตอบ #9 เมื่อ: 17 มกราคม 2013, 12:05:51 » |
|
ไม่สามารถเริ่มต้น session ได้ เพราะมีการ ปล่อยโค๊ดให้แสดงผลไปแล้ว ลองเช็คคำสั่งดีๆครับ ว่ามีการสั่งแสดงผล หรือพบการแสดงผลก่อน session_start() หรือไม่
|
|
|
บันทึกการเข้า
|
|
|
|
ICheer_No0M
Newbie
พลังน้ำใจ: 13
ออฟไลน์
กระทู้: 78
|
 |
« ตอบ #10 เมื่อ: 17 มกราคม 2013, 12:09:39 » |
|
UTF-8 Without BOM ใน notepad++ ครับ เคยเป็นบ่อย 
|
|
|
บันทึกการเข้า
|
|
|
|
bankker6480
สมุนแก๊งเสียว
พลังน้ำใจ: 162
ออฟไลน์
กระทู้: 710
|
 |
« ตอบ #11 เมื่อ: 17 มกราคม 2013, 12:43:21 » |
|
UTF-8 Without BOM ใน notepad++ ครับ เคยเป็นบ่อย  ทำเป็นแบบ UTF-8 Without BOM แล้วครับ
|
|
|
บันทึกการเข้า
|
|
|
|
|
bankker6480
สมุนแก๊งเสียว
พลังน้ำใจ: 162
ออฟไลน์
กระทู้: 710
|
 |
« ตอบ #13 เมื่อ: 17 มกราคม 2013, 18:47:04 » |
|
ดันๆ
|
|
|
บันทึกการเข้า
|
|
|
|
ba5nanas
ก๊วนเสียว
พลังน้ำใจ: 29
ออฟไลน์
กระทู้: 292
|
 |
« ตอบ #14 เมื่อ: 17 มกราคม 2013, 18:58:56 » |
|
<?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>TU_SHOP</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> <body> <center> <? $objConnect = mysql_connect("localhost","#","#") or
die("Error Connect to Database"); $objDB = mysql_select_db("postfree_dbweb"); mysql_query("SET NAMES UTF8"); mysql_db_query(postfree_dbweb,"SET NAME UTF8"); $strSQL = "SELECT * FROM files"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <table width="900" border="1"> <tr> <th width="50"> <div align="center">รหัสสินค้า</div></th> <th width="150"> <div align="center">ภาพสินค้า</div></th> <th width="150"> <div align="center">ชื่อสินค้า</div></th> <th width="400"> <div align="center">รายละเอียด</div></th> <th width="100"> <div align="center">ราคา</div></th> <th width="50"> <div align="center">แก้ไข</div></th> <th width="50"> <div align="center">ลบ</div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["FilesID"];?></div></td> <td><center><img src="MyProduct/<?=$objResult["FilesName"];?>"></center></td> <td><center><?=$objResult["Name"];?></center></td> <td><?=$objResult["Detail"];?></center></td> <td><center><?=$objResult["Price"];?></center></td> <td><center><a href="EditProduct.php?FilesID=<?=$objResult["FilesID"];?
>">Edit</a></center></td> <td><div align="center"><a href="DeleteProduct.php?FilesID=<?=$objResult
["FilesID"];?>">ลบ</a></div></td> </tr> <? } ?> </table> <? mysql_close($objConnect); ?> <a href="http://#/FormUploadProduct.php">เพิ่มสินค้า</a> | <a href="http://#/index.php">หน้าแรก</a> </center> </body> </html>
ส่วนมากผมเขียนเป็นโครงสร้างครับเลยไม่ค่อยเกิดปัญหา จะคล้ายๆ MVC ราวๆนั้น 
|
|
|
บันทึกการเข้า
|
|
|
|
gubaaball
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 184
ออฟไลน์
กระทู้: 1,678
|
 |
« ตอบ #15 เมื่อ: 17 มกราคม 2013, 19:22:19 » |
|
ผมเอาโค้ด<?php require_once('auth.php'); ?>ว่างบนหน้านี้ครับ  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>TU_SHOP</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head> <body> <center> <? $objConnect = mysql_connect("localhost","#","#") or
die("Error Connect to Database"); $objDB = mysql_select_db("postfree_dbweb"); mysql_query("SET NAMES UTF8"); mysql_db_query(postfree_dbweb,"SET NAME UTF8"); $strSQL = "SELECT * FROM files"; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); ?> <table width="900" border="1"> <tr> <th width="50"> <div align="center">รหัสสินค้า</div></th> <th width="150"> <div align="center">ภาพสินค้า</div></th> <th width="150"> <div align="center">ชื่อสินค้า</div></th> <th width="400"> <div align="center">รายละเอียด</div></th> <th width="100"> <div align="center">ราคา</div></th> <th width="50"> <div align="center">แก้ไข</div></th> <th width="50"> <div align="center">ลบ</div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["FilesID"];?></div></td> <td><center><img src="MyProduct/<?=$objResult["FilesName"];?>"></center></td> <td><center><?=$objResult["Name"];?></center></td> <td><?=$objResult["Detail"];?></center></td> <td><center><?=$objResult["Price"];?></center></td> <td><center><a href="EditProduct.php?FilesID=<?=$objResult["FilesID"];?
>">Edit</a></center></td> <td><div align="center"><a href="DeleteProduct.php?FilesID=<?=$objResult
["FilesID"];?>">ลบ</a></div></td> </tr> <? } ?> </table> <? mysql_close($objConnect); ?> <a href="http://#/FormUploadProduct.php">เพิ่มสินค้า</a> | <a href="http://#/index.php">หน้าแรก</a> </center> </body> </html> บนนี่บนขนาดไหนครับ ลองเอาโค้ดมาดูหน่อย
|
|
|
บันทึกการเข้า
|
|
|
|
bankker6480
สมุนแก๊งเสียว
พลังน้ำใจ: 162
ออฟไลน์
กระทู้: 710
|
 |
« ตอบ #16 เมื่อ: 17 มกราคม 2013, 20:14:36 » |
|
อ๋อได้แล้วครับ เป็นที่ Encoding จริงๆด้วย ขอบคุณมากครับทุกท่าน 
|
|
|
บันทึกการเข้า
|
|
|
|
|