<?php require_once('Connections/conn.php');
$conn=mysql_connect("localhost","root","root")or die("不能连接到数据库");
mysql_select_db("user",$conn)or die("can't connect to the servers");
$reback=0;
$sql="select * from user where name="'.$_GET['user'].'"";
$rst=$conn->Execute($sql)or die('execute error');
if($ret->RecordCount()==1)
{
$reback='2';
} else
{
$reback='1';
} echo $reback;
?>页面是验证用户名是否存在。
提示是SQL语句出了问题。请高手指教!
$conn=mysql_connect("localhost","root","root")or die("不能连接到数据库");
mysql_select_db("user",$conn)or die("can't connect to the servers");
$reback=0;
$sql="select * from user where name="'.$_GET['user'].'"";
$rst=$conn->Execute($sql)or die('execute error');
if($ret->RecordCount()==1)
{
$reback='2';
} else
{
$reback='1';
} echo $reback;
?>页面是验证用户名是否存在。
提示是SQL语句出了问题。请高手指教!
require_once('Connections/conn.php');
$conn=mysql_connect("localhost","root","root")or die("不能连接到数据库");
mysql_select_db("user",$conn)or die("can't connect to the servers");
$reback=0;
$sql="select * from user where name='".$_GET['user']."'"; //注意这句的引号
$rst=$conn->Execute($sql)or die('execute error');
if($ret->RecordCount()==1){
$reback='2';
}else{
$reback='1';
}echo $reback;
?>
$rst=$conn->Execute($sql)or die('execute error');
这行也有报错- -
$sql="select * from user where name='".intval($_GET['user'])."'";
不存在时sql语句不同样完蛋吗