我在SQL语法中有错误 [英] i have an error in SQL syntax

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

问题描述

这是我的代码,但我收到此错误:

您的SQL语法有错误;检查与MySQL服务器版本对应的手册,以便在'form login where user_name ='mahla'和密码='e10adc3949ba59abbe56e057f20f88'附近使用正确的语法。







 $ user_name = $ _ POST ['  user_name']; 
$ password = md5($ _ POST [' password']);



$ con = mysql_connect( localhost root 22646146);


mysql_select_db( bs,$ con);



$ query = select * form login where user_name ='$ user_name'和密码='$密码'LIMIT 1;

$ result = mysql_query($ query);
if($ result)
{
$ num_rows = mysql_num_rows($ result);
echo $ num_rows ;
} else {
echo mysql_error();}

解决方案

user_name =


_POST [' user_name'];

密码= MD5(

here is my code but i get this error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'form login where user_name='mahla' and password='e10adc3949ba59abbe56e057f20f88'




$user_name=$_POST['user_name'];
$password=md5($_POST['password']);



$con=mysql_connect("localhost","root","22646146");


mysql_select_db("bs",$con);



$query="select* form login  where user_name='$user_name' and password='$password'  LIMIT 1";

$result= mysql_query($query);
if($result)
{
$num_rows=mysql_num_rows($result);
echo $num_rows ;
}else{
echo mysql_error();}

解决方案

user_name=


_POST['user_name'];


password=md5(


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

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