As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center用于指导。
7年前关闭。
我想建立一个简单的CMS系统,它将直接连接到我的远程数据库(mysql),并能够添加、删除/更新字段/记录。
有什么例子吗,教程?我应该从哪里开始?
我假设语言是php?(是否有任何免费的脚本可以做到这一点?)。不管怎样,我都想建立自己的。

最佳答案

使用adminerphpMyAdmin
你不需要自己做。它们都是开源的,所以你可以浏览它并浏览代码
简单示例代码(显示表并允许删除表)

<?php
if ($_GET['del']){
    mysql_query("DROP TABLE ".$_GET['del']);
    echo "done";
}

if ($_POST['password']){
    $con = mysql_connect('localhost', $_POST['username'], $_POST['password']) or die("Wrong details");
    mysql_select_db($_POST['db']) or die("Wrong database");
}


if ($con){
    $result = mysql_query("SHOW TABLES");
    while($row = mysql_fetch_row($result)){
        echo "<br/>Table ".$row[0]." (<a href='?del=".$row[0]."'>Delete</a>)";
    }
    die();
}
?>

<form method="post" action="">
Username: <input name="username" /><br />
Password: <input name="password" /><Br />
Database: <input name="db" /><br />
<input type="submit" />
</form>

关于php - 建立一个简单的CMS来管理MySQL? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6866796/

10-11 03:34