如果是 mysqli 或 pdo 可以读空结果集
但你是 mysql 所以只能重新连接数据库
但你是 mysql 所以只能重新连接数据库
解决方案 »
- 下载的 MRBS 系统,登录的时候有段代码不解??
- 关于PHP判断浏览器语言
- 帮个忙,哈哈!
- 关于Form enctype="multipart/form-data"
- 推荐一个免费的画统计图的php控件,功能好强大啊
- 我的数据库字符格式为UTF-8,取出数据后中文为乱码。怎样解决啊?谢谢!
- 昨天面试了,主管说给一个星期熟悉PHP和MYSQL,以前没有半点的了解。请高人指点兄弟如何在一星期熟悉这东东啊?
- 求用PHP写的手机号码地区查询程序的代码!
- 怎么简单点装PHP?
- 以网页的形式开发数据库程序真是麻烦!!!!!!!
- 怎么用php读取ppt文档的内容,并且在浏览器中显示出来???
- PHP处理音频文件
require_once("db.php");//此文件位于下面
//显示表二计算结果
$query="call score2('PartTwo".$_REQUEST[num]."',@A,@B,@c,@D,@E,@F,@G,@score);";
$result=executeQuery($query);
if(!$result) die(mysql_error());
while($r=mysql_fetch_row($result)){
echo '<font style="color:#0000FF">睡眠质量(A):</font>'.$r[0].'     <font style="color:#0000FF">入睡时间(B):</font>'.$r[1].'     <font style="color:#0000FF">睡眠时间(C):</font>'.$r[2].'     <font style="color:#0000FF">睡眠效率(D):</font>'.$r[3].'     <font style="color:#0000FF">睡眠障碍(E):</font>'.$r[4].'     <font style="color:#0000FF">催眠药物(F):</font>'.$r[5].'     <font style="color:#0000FF">日间功能障碍(G):</font>'.$r[6].'     <font style="color:#0000FF">PSQI总分:</font>'.$r[7].'<br/><br/>';
}
mysql_free_result($result);
//显示表三计算结果
$query="call score('PartTwo".$_REQUEST[num]."',3,@score);";
$result=executeQuery($query);
if(!$result) die(mysql_error());
while($r=mysql_fetch_row($result)){
echo '<font style="color:#0000FF">SCORE:</font>'.$r[0].'   ';
if(($r[0]>6)&&($r[0]<12))
{
echo '瞌睡';
}elseif(($r[0]>11)&&($r[0]<17)){
echo '过度瞌睡';
}elseif($r[0]>16){
echo '有危险性的瞌睡';
}
}
mysql_free_result($result);
//以下为db.php
$dbserver="localhost";
$dbusername="question";
$dbpassword="questionadmin";
$dbname="questionnaire";
$conn=false;
function executeQuery($query)
{
global $conn,$dbserver,$dbname,$dbpassword,$dbusername;
global $message;
if (!($conn = @mysql_connect ($dbserver,$dbusername,$dbpassword)))
$message="Cannot connect to server";
if (!@mysql_select_db ($dbname, $conn))
$message="Cannot select database";
$result=mysql_query($query,$conn);
if(!$result)
$message="Error while executing query.<br/>Mysql Error: ".mysql_error();
else
return $result;
}
function closedb()
{
global $conn;
if(!$conn)
mysql_close($conn);
}