PHP mysql没有显示管理面板功能

时间:2014-10-28 10:27:06

标签: php mysql database add edit

所以我已经做了很长时间了。所以基本上我想要做的是做一个添加,更新,删除用户表。现在我正在制作一张表格,显示我在数据库中的内容以及编辑,删除或添加的选项。

我的数据库中有2个表。

将表与以下字段链接:PID,LinkName,AnchorText,CategoryID,CategoryName linkCategory表,其字段为:CategoryID,CategoryName

这是我迄今为止所拥有的......而且它根本没有显示出来。没有错误或任何东西。

<?php
// acquire shared info from other files
include("dbconn.inc.php"); // database connection 
include("shared.php"); // stored shared contents

// make database connection
$conn = dbConnect();

print $HTMLHeader; 
print $PageTitle;

?>
<script>
function confirmDel(title, pid) {
// javascript function to ask for deletion confirmation

    url = "admin_delete.php?pid="+pid;
    var agree = confirm("Delete this item: <" + title + "> ? ");
    if (agree) {
        // redirect to the deletion script
        location.href = url;
    }
    else {
        // do nothing
        return;
    }
}
</script>

<?php
// Retrieve the product & category info
$sql = "SELECT Links.PID, Links.AnchorText, linkCategory.CategoryName FROM Links, linkCategory where Links.CategoryID = linkCategory.CategoryID order by linkCategory.CategoryName";

$stmt = $conn->stmt_init();

if ($stmt->prepare($sql)){

    $stmt->execute();
    $stmt->bind_result($PID, $Title, $CategoryName);

    $tblRows = "";
    while($stmt->fetch()){
        $Title_js = htmlspecialchars($Title, ENT_QUOTES); // convert quotation marks in the product title to html entity code.  This way, the quotation marks won't cause trouble in the javascript function call ( href='javascript:confirmDel ...' ) below.  

        $tblRows = $tblRows."<tr><td>$Title</td>
                             <td>$CategoryName</td>
                             <td><a href='admin_form.php?pid=$PID'>Edit</a> | <a href='javascript:confirmDel(\"$Title_js\",$PID)'>Delete</a> </td></tr>";
    }

    $output = "<table border=1 cellpadding=4>\n
    <tr><th>Title</th><th>Category</th><th>Options</th></tr>\n".$tblRows.
    "</table>";

    $stmt->close();
} else {

    $output = "Query to retrieve product information failed.";

}

$conn->close();
?>


<?= $SubTitle_Admin ?>
<br>
| <a href="admin_form.php">Add a new item</a> |<br>

<?php echo $output ?>


<?php print $PageFooter; ?>

</body>
</html>

这是我的第一页,我仍然需要输入PHP进行编辑,更新和删除...但是甚至无法显示我的主页面。有点冗长,但我需要完成这件事。如果有人能帮助我,或指出正确的方向......我将不胜感激。以下是http://omega.uta.edu/~cyjang/ctec4321/lab/productList2/admin_productList.php应该是什么的链接。当我试图把它自己拉起来时,它是一个空白页......就像这样:http://omega.uta.edu/~dxh6110/4321/in%20class/linksadmin/admin_productList.php

0 个答案:

没有答案