<?php
$link = mysql_pconnect("localhost","root","1234") or die("Unable to connect server");
mysql_selectdb("test") or die("Unable to connect database");
mysql_query("SET NAMES 'UTF8'");
mysql_query("SET character_set_results='UTF8'");
$arr = array();
$rs = mysql_query("SELECT id,name,address,username,password FROM tbl_test");
$i = 0;
while($obj = mysql_fetch_object($rs))
{
$arr[] = $obj;
//echo $i." ".$obj->address."<br/>";
//$i+=1;
}
// add the header line to specify that the content type is JSON
header('Content-Type: application/javascript'); // <--- เพิ่มนี้เข้าไปแล้ว error เลย
echo "{\"NetBeansTest1\":" .json_encode($arr). "}";
?>
error คือ
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\grid2_1.php:1) in C:\AppServ\www\grid2_1.php on line 19
รบกวนข้อความคำแนะนำหน่อยครับ
Tag : PHP, MySQL, HTML/CSS, jQuery, CakePHP, Windows
error คือ
Warning: Cannot modify header information - headers already sent by (output started at C:\AppServ\www\grid2_1.php:1) in C:\AppServ\www\grid2_1.php on line 19