[前][次][番号順一覧][スレッド一覧]

mysql:8852

From: Kazuhiro Yoshida <Kazuhiro Yoshida <moriq@xxxxxxxxxx>>
Date: Sun, 22 Feb 2004 02:22:32 +0900
Subject: [mysql 08852] Re:

もりきゅうです。

<konet218@xxxxxxxxxx> wrote:
> と、申されましても何とも・・・(汗)
^^;
PHPの勉強がてら作ってみました。
* php-4.3.4-Win32.zip

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html lang="ja">
<head>
<title>t1</title>
<link rel=stylesheet type="text/css" href="pi.css">
<meta http-equiv="Content-Type" content="text/html; charset=shift_jis">
</head>

<body>

<?php
$db = mysql_connect("localhost","user","password"); // 変更してください
mysql_select_db("test"); // 変更してください
$res = mysql_query("select
    date_format(mail_datetime,'%Y-%m-%d') as mail_date,
    hour(mail_datetime) as mail_hour,
    count(*)
  from master_tb, mail_tb
  where master_group_id = 1
    and mail_to_master_id = master_id
  group by mail_date, mail_hour;");
while ($row = mysql_fetch_row($res)) {
  list($date, $hour, $count) = $row;
  $count_tb[$date][$hour] = $count;
//  echo join("\t", $row), "\n";
}
mysql_close($db);
?>

<table>
<tr>
<th>日付 / 時刻</th>
<?php
for ($hour = 0; $hour < 24; $hour++) {
  print "<th>$hour</th>\n";
}
?>
</tr>
<?php
$time = time();
$firstday_time = mktime(0,0,0,
  date("m",$time),1,date("Y",$time));
$time = $firstday_time;
while (1) {
  $date = date("Y-m-d",$time);
?>
<tr>
<td><?php print $date ?></td>
<?php
for ($hour = 0; $hour < 24; $hour++) {
  $count = $count_tb[$date][$hour];
  print "<td>$count</td>\n";
}
?>
</tr>
<?php
  $tomorrow_time = mktime(0,0,0,
    date("m",$time),date("d",$time)+1,date("Y",$time));
  if (date("m",$tomorrow_time) != date("m",$time))
    break;
  $time = $tomorrow_time;
}
?>
</table>

</body>
</html>

----
YOSHIDA Kazuhiro  moriq@xxxxxxxxxx  http://www.moriq.com/

[前][次][番号順一覧][スレッド一覧]

      8833 2004-02-20 17:48 [<lavlav@xxxxxxxxxx> ]                                         
      8834 2004-02-20 17:55 ┣[<lavlav@xxxxxxxxxx> ] Re: SQL 文について                    
      8836 2004-02-20 18:09 ┣[遠藤 俊裕 <endo_t@xx]                                       
      8839 2004-02-20 18:40 ┃┗[<lavlav@xxxxxxxxxx> ]                                     
      8841 2004-02-20 20:23 ┃ ┣[<numata@xxxxxxxxxx> ]                                   
      8844 2004-02-21 04:51 ┃ ┣[Kazuhiro Yoshida <mo]                                   
      8846 2004-02-21 14:24 ┃ ┃┗[<konet218@xxxxxxxxxx]                                 
      8849 2004-02-21 17:59 ┃ ┃ ┣[Kazuhiro Yoshida <mo]                               
      8850 2004-02-21 18:38 ┃ ┃ ┃┗[<konet218@xxxxxxxxxx]                             
->    8852 2004-02-22 02:22 ┃ ┃ ┃ ┗[Kazuhiro Yoshida <mo]                           
      8855 2004-02-22 16:11 ┃ ┃ ┗["katayose" <katayose]                               
      8857 2004-02-23 02:03 ┃ ┃  ┗[ML account <ml@xxxxx]                             
      8847 2004-02-21 15:16 ┃ ┗[ML account <ml@xxxxx]                                   
      8848 2004-02-21 17:18 ┃  ┗[<konet218@xxxxxxxxxx]                                 
      8838 2004-02-20 18:15 ┗[Shingo Yamagai <yama] Re: SQL 文について