php代码中的sql错误 [英] error on sql in php code

查看:72
本文介绍了php代码中的sql错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的朋友们,


我正在运行代码

$ check_1 = mysql_query(" SELECT * FROM user WHERE u_name =''"。

$ _POST [''username'']。"''")或die(mysql_error());


$ check_2 = mysql_num_rows( $ check);


但警告来了

"警告:mysql_num_rows():提供的参数不是有效的MySQL

结果资源在C:\Program Files \ Apache Service Foundation

\ Apache2.2 \第44行的htdocs\rajput_new\loginphp.php .."


$ _POST [''username'']在用户输入的相同代码上有表格名称

用户名..


有什么问题......

提前致谢...
$ b $原地

Dear friends,

I am running the code
$check_1 = mysql_query("SELECT * FROM user WHERE u_name = ''".
$_POST[''username'']."''") or die(mysql_error());

$check_2 = mysql_num_rows($check);

but the warning comes
" Warning: mysql_num_rows(): supplied argument is not a valid MySQL
result resource in C:\Program Files\Apache Software Foundation
\Apache2.2\htdocs\rajput_new\loginphp.php on line 44.."

$_POST[''username''] has name of form on same code the user enter
username..

What''s the problem...
Thanks in advance...
situ

推荐答案

check_1 = mysql_query(" SELECT * FROM user WHERE u_name =''"。
check_1 = mysql_query("SELECT * FROM user WHERE u_name = ''".


_POST [''username'']。"''")或die(mysql_error());

_POST[''username'']."''") or die(mysql_error());


check_2 = mysql_num_rows(
check_2 = mysql_num_rows(


这篇关于php代码中的sql错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆