是服务器的问题吗?(mysql)
我做了一个购物车,
用的是新网的标准一型,
但是浏览时有时候会出现:
too many connection....
failed………………!!!!!! 的错误
有时还会block server!!!!
我不知道还有没有其他人租万网的空间,
出没出现过这种情况,
出现这种情况,是我的代码的问题吗?
我的代码基本上像这样:
$html='';
$query='SELECT * FROM `subject` where father_id=0 order by show_order';
if(!($result=mysql_query($query))){
echo mysql_error();
die();
} //end if
if($result){
$i=0;
while($sub=mysql_fetch_array($result)){
$topsubject[$i]['name']=$sub['name'];
$topsubject[$i]['id']=$sub['id'];
$i++;
}//end while
}//end if
for($j=0;$j<$i;$j++)
{
$query='SELECT id,name FROM `subject` where father_id='.$topsubject[$j]['id'];
if(!($result=mysql_query($query))){
echo mysql_error();
die();
} //end if
if($result){
$html.='<table width="600" border="0" align="center" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td><img src="images/sub_'.$topsubject[$j]['id'].'.gif" width="174" height="15"></td>
</tr>
</table>
<table width="600" border="1" align="center" bordercolor="#3767A7" bgcolor="#F8F8F5" cellpadding="4" cellspacing="0" bordercolordark="#F8F8F5">
<tr bgcolor="#F8F8F5">
<td height="15">
<table width="580" border="0" align="center" cellspacing="2" cellpadding="2">';
while($sub=mysql_fetch_array($result)){
$html.='
<tr align="left" valign="top">
<td width="25%" height="2">
<p align="left"><img src="images/ad/vote_ar.gif" width="11" height="14">'.$sub['name'].'</p>
</td>';
if($sub=mysql_fetch_array($result))
{
$html.='<td width="25%" height="2">
<p align="left"><img src="images/ad/vote_ar.gif" width="11" height="14">'.$sub['name'].'</p>
</td>';
}else{
$html.='<td width="25%" height="2">
<p align="left"></p>
</td>';
}
if($sub=mysql_fetch_array($result))
{
$html.='<td width="25%" height="2">
<p align="left"><img src="images/ad/vote_ar.gif" width="11" height="14">'.$sub['name'].'</p>
</td>';
}else{
$html.='<td width="25%" height="2">
<p align="left"></p>
</td>';
}
if($sub=mysql_fetch_array($result))
{
$html.='<td width="25%" height="2">
<p align="left"><img src="images/ad/vote_ar.gif" width="11" height="14">'.$sub['name'].'</p>
</td>';
}else{
$html.='<td width="25%" height="2">
<p align="left"></p>
</td>';
}
$html.='
</tr>';
}//end while
$html.=' </table>
</td>
</tr>
</table>';
}//end if
}
请帮忙!谢谢!