php数据库有关问题,

WBOY
Release: 2016-06-13 11:32:38
Original
862 people have browsed it

php数据库问题,求助。。。。
初学PHP来的,想自己写一个登陆的页面,但现在连验证帐号都过不去,请大家看下我的代码是哪里有问题 

<?php <br />$user123 = $_POST['user']; <br />$db = new mysqli($sqln,$sqlu,$sqlp,$sqld) or die("Error in the consult.." . mysqli_error($db)); <br />$query = "SELECT 'user_email' FROM 'user' WHERE 'user_email' = '$user123'"; <br />// mysql_select_db($sqld); <br />mysqli_select_db($db, $sqld); <br />$result = $db->query($query) or die("Error in the consult.." . mysqli_error($db)); <br />if ($result == 1){ <br />echo "<p> 登陆成功 </p>"; <br />} <br />elseif ($result == 0){ <br />echo "<p> 没有找到 </p>"; <br />} <br /><br />echo $_POST["user"]; <br />$dba = $db->affected_rows; <br />echo $dba; <br />mysqli_close($db); <br />?> 
Copy after login

$result = $db->query($query) or die("Error in the consult.." . mysqli_error($db));
这句不加后面的错误显示的话后面的 echo $dba 显示的是-1,但是我输入的帐号在数据库里面是有的。
我输入的user123是 vvvvy
但是网页打开来提交后显示这个错误 Error in the consult..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 ''user' WHERE 'user_email' = 'vvvvy'' at line 1

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template