我对 PHP 比较陌生。我想让我的用户能够对位于我网站上的企业进行评论,但我不确定如何实现代码。在下面的 URL 中,我希望我的用户点击企业名称并能够撰写对此类企业的评论。我没有要求任何人为我编写代码,但我要问的是,下一个过程是什么?我如何攻击/解决我拥有的这个程序。接下来我该怎么办......
感谢大家。
http://whatsmyowncarworth.com/practiceTemplate/practice1/33/loans/table3.php
<?php
include('init.php');
/*$sql = "SELECT * FROM cars WHERE id='1' ORDER BY year ASC";*/
$sql = "SELECT * FROM dealers";
if ($result = mysql_query($sql)) {
echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Address</th> <th>State</th> <th>City</th> <th>Website</th> ";
// keeps getting the next row until there are no more to get
while ($row = mysql_fetch_array($result)){
$name = $row['name'];
$address = $row['address'];
$state = $row['state'];
$city = $row['city'];
$website = $row['website'];
$maps = $row['maps'];
$lat = $row['lat'];
$lng = $row['lng'];
echo("\t<tr>\n");
echo("\t\t<td>" . "<a href='http://$website' target = '_blank'>" . "$name" . "</a></td>\n");
echo("\t\t<td>" . "$address" . "</td>\n");
echo("\t\t<td>" . "$state" . "</td>\n");
echo("\t\t<td>" . "$city" . "</td>\n");
echo("\t\t<td>" . "<a href='http://$website' target = '_blank'>" . "$name" . "</a></td>\n");
/*echo("\t\t<td>" . "<a href='http://$website' target = '_blank'>" . "$name" . "</a></td>\n");
echo("\t\t<td>" . "<a href='http://$maps' target = '_blank'>" . "$address" . "</td>\n");
echo("\t\t<td>" . "<a href='http://$maps' target = '_blank'>" . "$address" . "</td>\n");
echo("\t\t<td>" . "$state" . "</td>\n");
echo("\t\t<td>" . "$city" . "</td>\n");
echo ("\t\t<td>" . "<a href='http://$website' target = '_blank'>" . "$website" . "</a></td>\n");
echo("\t\t<td>" . "$maps" . "</td>\n");
echo("\t\t<td>" . "$lat" . "</td>\n");
echo("\t\t<td>" . "$lng" . "</td>\n");*/
// Print out the contents of each row into a table
}
echo "</table>";
}
else {
trigger_error(mysql_error()); // for development only; remove when in production
}
?>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
</body>
</html>