我有这个链接floors.php?id=building1&floor1
它表现得像这样
flats.php?id=Building1&1
建筑物名称及楼层编号
链接有楼层编号和建筑名称
现在我如何在MySQL查询中连接
$query = "SELECT * FROM floors where buildingname='$id' And
floorno='i want here floor no how can i do this' ORDER BY floorno 发布于 2013-11-24 13:14:50
在你的网址里应该是,
floors.php?id=1&floorno=5在php文件中,
你可以用,
$id = mysql_real_escape_string($_GET['id']); //output =1.
$floorno = mysqli_real_escape_string($_GET['floorno']); // output=5
$query = "SELECT * FROM floors where buildingname='".$id."' and floorno='".$floorno."' ORDER BY floorno 您可以使用mysqli_real_escape_string()
mysqli_real_escape_string()调用MySQL的库函数mysqli_real_escape_string,该函数将反斜杠添加到以下字符:\x00、\n、\r、\、“和\x1a
注意: mysql_*不建议使用MySQLi或PDO_MySQL扩展
https://stackoverflow.com/questions/20174828
复制相似问题