我试图通过搜索查询查看来自SQL输入的数据元组,但是,结果显示了php代码的摘录。
html页面显示的结果是:
"; } } else { echo "Not Found!!!"."
"; } mysql_close(); ?>
我需要帮助才能看出哪里出了问题。下面是SQL代码:
<html>
<head>
<title>Booking Results</title>
</head>
<BODY>
<p> </p>
<p> </p>
<p> </p>
<blockquote>
<p>
<!-- <img src='search.jpg' width=50px height=50px> //-->
<h2>Search Booking Result</h2>
<?php
/* connect to my sql */
$con = mysql_connect("localhost","root","password");
if (!$con)
die('Could not connect: ' . mysql_error());
mysql_select_db("database", $con);
/* retrieve all variables */
$keyword = @$_POST["Activity"];
$searchin = @$_POST["searchin"];
/* execute query */
$sql="select * from sportscomplex where $searchin LIKE '%$keyword%'";
$result = mysql_query($sql);
$num=mysql_num_rows($result);
if($num != 0)
{
while($row = mysql_fetch_array($resultActivity))
{
echo $row['Activity']." ".$row['Venue']." ".$row['Hall']." ".$row['Day']
." ".$row['Status']." ".$row['Date']."<br>";
}
}
else
{
echo "Not Found!!!"."<br>";
}
mysql_close();
?>
</blockquote>
</body>
</html>