<?php
$link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
mysql_query("set names 'utf8'");
mysql_query("set character set utf8");
mysql_query("set character_set_result=utf8");
if($link)
{
mysql_select_db(SAE_MYSQL_DB,$link);
}else{
die(mysql_error());
}
$link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS);
mysql_query("set names 'utf8'");
mysql_query("set character set utf8");
mysql_query("set character_set_result=utf8");
if($link)
{
mysql_select_db(SAE_MYSQL_DB,$link);
}else{
die(mysql_error());
}
?>
<?php
require "mysql_connect.php";
$n=0;
$result=mysql_query("select * from news");
while($row=mysql_fetch_array($result)){
$arr[$n++]=array("title"=>$row['title'],
"desc"=>$row['desc'],
"time"=>$row['time'],
"content_url"=>$row['content_url'],
"pic_url"=>$row['pic_url']
);
}
echo json_encode($arr);