最近我的个人网站老是出现连接不上数据库的问题(原因未知),导致在用户提交数据的时候,数据丢失。现在我想在连接mysql失败的时候再重新连接,直到连接成功为止。
大家看看我写的这个方法有没有问题,在这里用mysql_pconnect好还是用mysql_connect好?
function OpenMysql(){
if(!mysql_pconnect("localhost","root","root")){
return OpenMysql();
}
else{
return true;
}
}
大家看看我写的这个方法有没有问题,在这里用mysql_pconnect好还是用mysql_connect好?
function OpenMysql(){
if(!mysql_pconnect("localhost","root","root")){
return OpenMysql();
}
else{
return true;
}
}
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货