查询执行中的问题 [英] Problem in execution of query
本文介绍了查询执行中的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在这里遇到问题:
首先,myquery未执行;
我发现这样的错误
I have a problem here:
first, myquery not executed;
and i catch a errer like this
(Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in C:\Program Files (x86)\EasyPHP-5.3.5.0\www\jadid\logincontrol.php on line 26 )
另外,我的数据库是newsdb,表是用户,新闻和用户名和密码的类型是varchar.
谢谢
and in addition, my database is newsdb and tables are users and news and type of username and password are varchar.
Thanks
$user = $_POST['txtuser'];
$pass = $_POST['txtpassword'];
$con=mysql_connect('localhost','root','');
if(!$con)
{
echo "Connection is Failed!!";
exit;
}
mysql_select_db('newsdb');
$query=""select username from users where username='$user' and password='$pass'";
$allRows=mysql_query($query);
if($allRows)
{
echo "Query Not Executed!!";
exit;
}
echo $allRows;
$numRows=mysql_num_rows($allRows);
if($numRows)
{
$_SESSION['user']=$user;
echo "<center>Welcome ".$_SESSION['user']." to your site<br>";
echo "<a href=user.php>Please click here on this link to load your page</a></center>";
推荐答案
user =
user =
_POST [' txtuser'];
_POST['txtuser'];
pass =
pass =
这篇关于查询执行中的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文