thinkphp中sql语句的执行,mysql_query总是失败,哪里错了? 5
$m=M('meeting');$n=M('student');$con=mysql_connect("localhost");if(!$con){die('Couldn...
$m=M('meeting');
$n=M('student');
$con = mysql_connect("localhost");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("hd_people", $con);
$sql="INSERT into hd_studentcheck(meetingID,sstudentID,dept,name) select $m.id,$n.id,$n.dept,$n.name from hd_student,hd_meeting where $m.id='1';";
$s=mysql_query($sql);
if($s){
$this->success('成功!','xxx');
}
else{
$this->error('失败!','xxx');
} 展开
$n=M('student');
$con = mysql_connect("localhost");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("hd_people", $con);
$sql="INSERT into hd_studentcheck(meetingID,sstudentID,dept,name) select $m.id,$n.id,$n.dept,$n.name from hd_student,hd_meeting where $m.id='1';";
$s=mysql_query($sql);
if($s){
$this->success('成功!','xxx');
}
else{
$this->error('失败!','xxx');
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询