接受data传过来的值 放到sql里面 sql就是没结果
<?php
//header("Content-Type:text/html;charset=gbk");
include("conn.php");
$sql1="select * from loupan where area = '".trim($_POST['name'])."' limit 0,12 ";
echo $sql1;
$rs1=mysql_query($sql1);
echo s4
while($row1=mysql_fetch_array($rs1))
{
echo "<div class='d_box'>";
echo "<div class='h_t_village'>" ;
echo "<a href='#' class='h_t_va'>".$row1['village']."</a>";
echo "</div>" ;
echo "<div class='h_t_pri_box'>";
echo "<div class='h_t_pri'>";
echo "<strong>".$row1['pri']."</strong>";
echo "</div>";
echo "<div class='h_t_prim'> 元/㎡</div>";
echo "</div>";
echo "</div>";
}
?>
$sql1="select * from loupan where area = '".trim($_POST['name'])."' limit 0,12 ";
echo $sql1和$rs1能看到 select * from loupan where area = '岳麓区' limit 0,12 Resource id #5但是后面的就没了
我试着改成$sql1="select * from loupan where area = '岳麓区' limit 0,12"下面的就全出来了,这是怎么回事啊
<?php
//header("Content-Type:text/html;charset=gbk");
include("conn.php");
$sql1="select * from loupan where area = '".trim($_POST['name'])."' limit 0,12 ";
echo $sql1;
$rs1=mysql_query($sql1);
echo s4
while($row1=mysql_fetch_array($rs1))
{
echo "<div class='d_box'>";
echo "<div class='h_t_village'>" ;
echo "<a href='#' class='h_t_va'>".$row1['village']."</a>";
echo "</div>" ;
echo "<div class='h_t_pri_box'>";
echo "<div class='h_t_pri'>";
echo "<strong>".$row1['pri']."</strong>";
echo "</div>";
echo "<div class='h_t_prim'> 元/㎡</div>";
echo "</div>";
echo "</div>";
}
?>
$sql1="select * from loupan where area = '".trim($_POST['name'])."' limit 0,12 ";
echo $sql1和$rs1能看到 select * from loupan where area = '岳麓区' limit 0,12 Resource id #5但是后面的就没了
我试着改成$sql1="select * from loupan where area = '岳麓区' limit 0,12"下面的就全出来了,这是怎么回事啊
问题已经解决了
echo $_POST['name']能取到值,我这页面用的gbk。但是POST来的参数编码不是gbk的
我把$_POST['name']转码后 就行了