[PHP-users 28334] Re: エラーメッセージ Fatal error: Maximum execution time of 30 seconds exceeded
 西村
 cayanon @ yahoo.co.jp
 
 2006年 2月 6日 (月) 08:40:24 JST
 
 
 
説明不足でごめんなさい。
ソースコードは以下です。
<?php
 require_once("db.php");
 $PAGESIZE=20;
 $con = mysql_connect($dbserver,$dbuser,$dbpassword);
 $selectdb = mysql_select_db($dbname, $con);
if (!isset($page)) {
 $sql = "select count(*) as cnt from T1/科目マスタ";
 $rst = mysql_query($sql, $con);
 $col = mysql_fetch_array($rst);
 $tcnt = $col["cnt"];
 mysql_free_result($rst);
 $page = 1;
 }
 $totalpage = ceil($tcnt / $PAGESIZE);
 if ($page < $totalpage) {
 $pagehead = "<font size=2 color=#808080>".($PAGESIZE *
($page - 1) + 1) . "-".($PAGESIZE * $page) . "
件/".$tcnt."件中</font>";
 }
 else {
 $pagehead = "<font size=2 color=#808080>".($PAGESIZE *
($page - 1) + 1) . "-".$tcnt."
件/".$tcnt."件中</font>";
 }
$sql = "select * from T1/科目マスタ limit " .
 $PAGESIZE * ($page - 1) . ", $PAGESIZE";
 
 
 $rst = mysql_query($sql, $con);
 $body = "<TABLE border='0' cellpadding='3'
cellspacing='2'>
 <TR>
 <TH bgcolor='#b9e8ae'><font size=2>ソート
順</font></TH>
 <TH bgcolor='#b9e8ae'><font
size=2>科目名</font></TH>
 <TH bgcolor='#b9e8ae'><font
size=2>分類</font></TH>
 <TH bgcolor='#b9e8ae'><font size=2>入出金
区分</font></TH>
 <TH bgcolor='#b9e8ae'><font size=2>科目区
分</font></TH>
 <TH bgcolor='#b9e8ae'><font
size=2>編集</font></TH>
 <TR>\n";
	$cnt = 0;
 $acolor = array('#efefef','#ffffff');
 while($cnt < $tcnt) {
 
 while($col = mysql_fetch_array($rst)) {
//↑ここでエラーになります。
	$cnt++;
	$color=$acolor[$cnt%2];
 $body .= "<TR bgColor= $color>\n";
 $body .= "<TD><font size=2>" . $col["ソート順"] .
"</font></TD>\n";
 $body .= "<TD><font size=2>" . $col["科目"] .
"</font></TD>\n";
 $body .= "<TD><font size=2>" . $col["分類"] .
"</font></TD>\n";
 $body .= "<TD><font size=2>" . $col["入出金区分"] .
"</font></TD>\n";
 $body .= "<TD><font size=2>" . $col["科目区分"] .
"</font></TD>\n";
 $body .= "<td align=center><font size=2>"."<a
href='master_kamoku_edit.php?NO=".$col['
科目NO']."'>編集</a>" . "</font></TD>\n";
 
 $body .= "</TR>\n";
 }}
 $body .= "</TABLE>\n";
 mysql_free_result($rst);
 $con = mysql_close($con);
 
 if ($page > 1) {
 $pagehead .= " <font size=2><A href =
'$PHP_SELF?page=" . ($page - 1) . "&tcnt=$tcnt'>" .
 "←前へ</A></font> ";
 }
 if ($totalpage > 1 and $page < $totalpage) {
 $pagehead .= " <font size=2><A href =
'$PHP_SELF?page=" . ($page + 1) . "&tcnt=$tcnt'>" .
 "次へ→</A></font>";
 }
?>
Fatal error: Maximum execution time of 30 seconds exceeded
になります。
limit以下を取るとクエリーは実行されます。
limitの使い方がおかしいのでしょうか??
教えてください。宜しくお願いします。
使用環境
windows98、php4.3.2、mysql4.0.14b
 
 
PHP-users メーリングリストの案内