⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 categorybrowser.php

📁 这是php专业项目实例开发一书的源代码,希望对大家有所帮助!
💻 PHP
字号:
<html>
<head>
<title>Category browser</title>
</head>

<body bgcolor="#FFFFFF" text="#000000">

<?php

$connect= mysql_connect("localhost","root","") 
   or die("Could not connect to MySQL server in localhost !");

$selectdb=mysql_select_db("books") 
   or die("Could not select books data database !");

$sqlquery = "SELECT * from category";
$queryresult = mysql_query($sqlquery);

echo "<table width=700 border=1 align=center>";
echo " <tr>";
echo "  <td width=200> <center><b>Category ID </b></center></td>\n";
echo "  <td width=200> <center><b>Name </b></center></td>\n";
echo "  <td width=200> <center><b>Description</b></center></td>\n";
echo "  <td width=100> <center><b>Parent Category ID</b></center></td>\n";
echo "  <td width=100> <center><b>Products</b></center></td>\n";

echo "  </tr>\n";
while ($row=mysql_fetch_array($queryresult)) 
{
  echo "  <tr>\n";
  echo "    <td>".$row["categoryid"]."</td>\n";
  echo "    <td>".$row["name"]."</td>\n";
  echo "    <td>".$row["description"]."</td>\n";
  echo "    <td>".$row["parentcategoryid"]."</td>\n";
$sqlquery2 = "SELECT name,categoryid from category where categoryid='".$row["categoryid"]."'";
$queryresult2 = mysql_query($sqlquery2);
if ($row2=mysql_fetch_array($queryresult2)) 
{  echo "    <td><A href=\"catprobrowser.php?categoryid=".$row["categoryid"]."\">Products</a></td>\n";
}  echo "    <td><A href=\"deletecategory.php?categoryid=".$row["categoryid"]."\">delete</a></td>\n";
  echo "  </tr>\n";
}
echo "</table>\n";
?>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -