elseif($keyword==绩效查询)
{
$msgtype = text;
$contentstr = 请输入您的学号;
$resultstr = sprintf($texttpl, $fromusername, $tousername, $time, $msgtype, $contentstr);
}else if(is_numeric($keyword)){
if(strlen($keyword)==7)
{
//////
$contentstr = 进入 if(strlen($keyword)==7);
$resultstr = sprintf($texttpl, $fromusername, $tousername, $time, $msgtype, $contentstr);
////
$con = mysql_connect(sae_mysql_host_m.':'.sae_mysql_port,sae_mysql_user,sae_mysql_pass); if(!$con) { ////// $contentstr = 进入 if(!$con); $resultstr = sprintf($texttpl, $fromusername, $tousername, $time, $msgtype, $contentstr); //// die('could not connect:'.mysql_error()); }else{ ///// $contentstr = 进入else; $resultstr = sprintf($texttpl, $fromusername, $tousername, $time, $msgtype, $contentstr); ///// mysql_select_db(app_cjcx123,$con); $query = sprintf(select * from table1 where xm = 1450375); $result = mysql_query($query); while ($row = mysql_fetch_assoc($result)) { $contentstr=$row['xm'].$row['cj']; mysql_close($con); } } }else if(!is_numeric($keyword)){ $msgtype = text; $contentstr = 学号错误,请重新输入; $resultstr = sprintf($texttpl, $fromusername, $tousername, $time, $msgtype, $contentstr); }else{ $contentstr = input something...; $resultstr = sprintf($texttpl, $fromusername, $tousername, $time, $msgtype, $contentstr); } } 这是源码。加了几个输出,卡到 $con = mysql_connect(sae_mysql_host_m.':'.sae_mysql_port,sae_mysql_user,sae_mysql_pass); 这一句,后面的if else 都没进去,求教,连接数据库的 几个参数需要定义全局变量还是怎么弄