<?php
header("Content-type:text/html;charset=utf-8");
$con=mysql_connect('localhost','xiaochu','xiaochu');
mysql_select_db('xiaochu',$con);
//mysql_query('set names utf8');
$sql="SELECT labnum FROM pre_ucenter_members where labnum=".$_GET['labnum']."";
if(!$sql)
$sql=0;
$sql=1;
print_r($sql);
exit();
?>
clienlogin.php?labnum=12345678 这样请求,如果表中有12345678网页显示1,如果没有,,网页显示0 这个该怎么改啊
第1个回答 推荐于2016-01-15
<?php
header("Content-type:text/html;charset=utf-8");
$con=mysql_connect('localhost','xiaochu','xiaochu');
mysql_select_db('xiaochu',$con);
//mysql_query('set names utf8');
$sql="SELECT labnum FROM pre_ucenter_members where labnum=".$_GET['labnum']."";
$result = mysql_query($sql,$con0);//这里执行查询语句
$count = mysql_num_rows($result);//这里获得上面查询的结果条数
if($count){
echo 1;//如果结果条数大于等于1,则直接在页面上输出1
}else{
echo 0;
}
//print_r($sql);
//exit();
?>本回答被提问者采纳
header("Content-type:text/html;charset=utf-8");
$con=mysql_connect('localhost','xiaochu','xiaochu');
mysql_select_db('xiaochu',$con);
//mysql_query('set names utf8');
$sql="SELECT labnum FROM pre_ucenter_members where labnum=".$_GET['labnum']."";
$result = mysql_query($sql,$con0);//这里执行查询语句
$count = mysql_num_rows($result);//这里获得上面查询的结果条数
if($count){
echo 1;//如果结果条数大于等于1,则直接在页面上输出1
}else{
echo 0;
}
//print_r($sql);
//exit();
?>本回答被提问者采纳
第2个回答 2014-07-26
header("Content-type:text/html;charset=utf-8");
$con=mysql_connect('localhost','xiaochu','xiaochu');
mysql_select_db('xiaochu',$con);
//mysql_query('set names utf8');
$sql="SELECT labnum FROM pre_ucenter_members where labnum=".$_GET['labnum']."";
$result=mysql_query($sql, $con);
$res=0;
if($result){
$res=1;
}
print_r($res);
exit();
$con=mysql_connect('localhost','xiaochu','xiaochu');
mysql_select_db('xiaochu',$con);
//mysql_query('set names utf8');
$sql="SELECT labnum FROM pre_ucenter_members where labnum=".$_GET['labnum']."";
$result=mysql_query($sql, $con);
$res=0;
if($result){
$res=1;
}
print_r($res);
exit();
第3个回答 推荐于2016-10-30
header("Content-type:text/html;charset=utf-8");
$con=mysql_connect('localhost','xiaochu','xiaochu');
mysql_select_db('xiaochu',$con);
//mysql_query('set names utf8');
$sql = "SELECT labnum FROM pre_ucenter_members where labnum=".$_GET['labnum']."";
$result = mysql_query($sql,$con);
$row = mysql_fetch_row($result);
if($row[0])
echo 1;
else
echo 0;
$con=mysql_connect('localhost','xiaochu','xiaochu');
mysql_select_db('xiaochu',$con);
//mysql_query('set names utf8');
$sql = "SELECT labnum FROM pre_ucenter_members where labnum=".$_GET['labnum']."";
$result = mysql_query($sql,$con);
$row = mysql_fetch_row($result);
if($row[0])
echo 1;
else
echo 0;
第4个回答 2014-07-26
你查询的句柄就是$sql
现在你只需要判断$sql就可以了吧。
if($sql){
echo 1;
}
else
{
echo 0;
}