我试图创建一个具有 categoryName 和 categoryDescription 的链接。一旦我单击将我带到该类别的链接,url 上的 cid 就不会显示,它应该有类似 cid=1 的东西。
这是已编写的代码...
<div id="content">
<?php
include_once("connection.php");
//category area
$sql = "SELECT * FROM ecommerce_category_table ORDER BY categoryName ASC";
$result = mysql_query($sql) or die(mysql_error());
$categories = "";
if (mysql_num_rows($result) > 0) {
while ($row = mysql_fetch_assoc($result)) {
$id = $row['$id'];
$name = $row['categoryName'];
$description = $row['categoryDescription'];
$categories .= "<a href='view_category.php?cid=".$id."' class='cat_link'>".$name." - ".$description."</a>";
}
echo $categories;
} else {
echo "<p>There are no categories avaliable yet.</p>";
}
?>
</div><!-- end content -->