[1012]PHP進階開發及TadTools工具應用
<?php
include_once "header.php";
$sql = "select `sn` , `name` , `birthday` from `".$xoopsDB->prefix("contact")."`";
$result = $xoopsDB->query($sql) or redirect_header($_SERVER['PHP_SELF'],3, mysql_error());
$all_content="";
$i=0;
while($all=$xoopsDB->fetchArray($result)){
//以下會產生這些變數: $tel , $email , $name , $gsn , $sn , $birthday , $zip , $county , $city , $addr
foreach($all as $k=>$v){
$$k=$v;
}
$myEvents[$i]['id']=$sn;
$myEvents[$i]['title']=$name;
$myEvents[$i]['start']=strtotime($birthday);
$i++;
}
echo json_encode($myEvents);
?>