我正在尝试制作一个简单的搜索查询脚本,它将从表单中提取结果并相应地从数据库中返回结果。
'连接.php'
<?php
$strServer = "http://server33.000webhost.com";
$strDatabase = "******";
$strUser = "******";
$strPwd = "******";
$strDB = mysql_connect($strServer, $strUser, $strPwd) or die ("Could not connect to database"); print mysql_error();
$database = mysql_select_db("$strDatabase", $strDB); print mysql_error();
?>
'搜索.php'
<?php
ini_set ('display_errors', 1);
include ('connect.php'); print mysql_error();
$query = ('SELECT * FROM 'properties' WHERE ('type' = '$_POST['type']') OR ('area' = '$_POST['area']')');
$result = mysql_query($query) or die ("Couldn't execute query."); print mysql_error();
while($r = mysql_fetch_array($result))
{
echo $r['type'];
echo $r['area'];
}
?>
我搜索了无数的论坛和教程,看不出我做错了什么。请帮帮我!提前致谢