Warning: mysql_free_result(): supplied argument is not a valid MySQL result resource in E:\
<?$link=mysql_connect("localhost","root","000000");mysql_query("useexample1");$sqlstr...
<?
$link = mysql_connect("localhost","root","000000");
mysql_query("use example1");
$sqlstr="select * from member1 where name ='".$_POST['member1_name']."' and passwd = '".$_POST['member1_passwd']."'";
$result = mysql_query($sqlstr,$link);
if (mysql_num_rows ($result)==1){
echo "<center>会员成功登陆</center>";
}else{
echo "<center>会员登录失败</center>";
}
mysql_free_result($result);
mysql_close($link);
?> 展开
$link = mysql_connect("localhost","root","000000");
mysql_query("use example1");
$sqlstr="select * from member1 where name ='".$_POST['member1_name']."' and passwd = '".$_POST['member1_passwd']."'";
$result = mysql_query($sqlstr,$link);
if (mysql_num_rows ($result)==1){
echo "<center>会员成功登陆</center>";
}else{
echo "<center>会员登录失败</center>";
}
mysql_free_result($result);
mysql_close($link);
?> 展开
2个回答
展开全部
你改成这样吧:
<?
$link = mysql_connect("localhost","root","000000");
mysql_select_db("use example1");//不是mysql_query('use ...');...
$sqlstr="select * from member1 where name ='$_POST[member1_name]' and passwd = '$_POST[member1_passwd]'";//$_POST[member1_name]和$_POST['member1_name']一样的,在速度不一样,不过没关系啦。
$result = mysql_query($sqlstr);//直接执行执行就好了。
if (mysql_num_rows ($result)==1){
echo "<center>会员成功登陆</center>";
}else{
echo "<center>会员登录失败</center>";
}
mysql_free_result($result);//你出错就在这里。那你干脆别要了。
mysql_close($link);//你八成教科书看多了。呵呵,最后这两行要不要无所谓。
?>
<?
$link = mysql_connect("localhost","root","000000");
mysql_select_db("use example1");//不是mysql_query('use ...');...
$sqlstr="select * from member1 where name ='$_POST[member1_name]' and passwd = '$_POST[member1_passwd]'";//$_POST[member1_name]和$_POST['member1_name']一样的,在速度不一样,不过没关系啦。
$result = mysql_query($sqlstr);//直接执行执行就好了。
if (mysql_num_rows ($result)==1){
echo "<center>会员成功登陆</center>";
}else{
echo "<center>会员登录失败</center>";
}
mysql_free_result($result);//你出错就在这里。那你干脆别要了。
mysql_close($link);//你八成教科书看多了。呵呵,最后这两行要不要无所谓。
?>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询