//日本時間の取り出し
putenv("TZ=JST-9");
$timestampJ = mktime();
$JST_y=strftime( "%Y",$timestampJ);
$JST_m=strftime( "%m",$timestampJ);
$JST_d=strftime( "%d",$timestampJ);
$JST_H=strftime( "%H",$timestampJ);
$JST_M=strftime( "%M",$timestampJ);
$JST_s=strftime( "%s",$timestampJ);
$tourokubi = $JST_y."-".$JST_m."-".$JST_d." ".$JST_H.":".$JST_M.":"."00";
$today = $JST_y."年".$JST_m."月".$JST_d."日";
//DBのオープン開始
$dbHandle=mysql_connect ("localhost", "nstar10_7starweb", "2549TA") ;
//DBの選択//DBの接続に失敗した場合はエラー表示をおこない処理中断
if ($dbHandle == False) {
print ("can not connect db\n");
exit;
}
//DB名
$db = "nstar10_diet";
$sql = "select * from onepoint";
//SQL文の実行
$rs = mysql_db_query($db,$sql);
if( !$rs ) {
print "登録に失敗しました。ブラウザの戻るボタン押してやり直してください。
\n";
print "SQL: $sql
\n";
print "Error: " . mysql_error() . "
\n";
exit;
}
$ct = 1;
while( $row = mysql_fetch_array($rs) ) {
$onepoint[$ct] = $row['onepoint']; //ユーザーID
$ct++;
}
//DBへの接続を切断
mysql_close($dbHandle);
$onepoint_index = mt_rand(1,$ct-1);
?>
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||
|