php mysql 语句问题
$area="select*fromareawhereareaCode=".$rows['area'];$re=$conn->db_query($area);$ro=my...
$area = "select * from area where areaCode = ".$rows['area'];
$re = $conn->db_query($area);
$ro = mysql_fetch_assoc($re);
$aN = $ro['areaName'];
为什么简化成这样不行?
$area = "select areaName as $ aN from area where areaCode = ".$rows['area'];
$conn->db_query($area); 展开
$re = $conn->db_query($area);
$ro = mysql_fetch_assoc($re);
$aN = $ro['areaName'];
为什么简化成这样不行?
$area = "select areaName as $ aN from area where areaCode = ".$rows['area'];
$conn->db_query($area); 展开
3个回答
展开全部
$area = "select * from area where areaCode = ".$rows['area'];
areaCode是int类型的字段才可以,否则应该这样:
$area = "select * from area where areaCode = '".$rows['area']."'";
$area = "select areaName as $ aN from area where areaCode = '".$rows['area']."'";是
取一个字段的值了,而上面是取一条或多条记录,根据你的需要了。
areaCode是int类型的字段才可以,否则应该这样:
$area = "select * from area where areaCode = '".$rows['area']."'";
$area = "select areaName as $ aN from area where areaCode = '".$rows['area']."'";是
取一个字段的值了,而上面是取一条或多条记录,根据你的需要了。
展开全部
$area = "select areaName as $ aN from area where areaCode = ".$rows['area'];
能这样写吗?
能这样写吗?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
想简单就封装一下吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询