100字范文,内容丰富有趣,生活中的好帮手!
100字范文 > PHP5对Mysql5的任意数据库表的管理代码示例(四)

PHP5对Mysql5的任意数据库表的管理代码示例(四)

时间:2019-11-23 20:07:31

相关推荐

PHP5对Mysql5的任意数据库表的管理代码示例(四)

php教程|php手册

PHP5,对,Mysql5,任意,数据库,表,管理,代码,示例,四,续,如果,点击,删除,一个,条目,则,会跳,转到

php教程-php手册

续:如果点击删除一个条目则会跳转到del.php(做为现在的主流开发语言)

//del.php(做为现在的主流开发语言)

Deleting an entry from the databaseDelete an entry

<?

$database = “sunsite”;

$tablename = $_REQUEST[tablename];

echo “Data from $tablename“;

MySQL(和PHP搭配之最佳组合)_connect(“localhost”,”root”,””) or die (“Problem connecting to DataBase”);

$query = “show columns from $tablename”;

$result = MySQL(和PHP搭配之最佳组合)_db_query($database,$query);

$column = 0;

if ($result)

{

echo “Found these entries in the database:

“;

echo “

移动端h5小游戏源码下载,大麦盒子安装ubuntu,怎么安装tomcat解压版,爬虫 腾讯漫画,php设置a标签边框,菲律宾SEO推广lzw

“;

}

else echo “No data.”;

MySQL(和PHP搭配之最佳组合)_free_result($result);

?>

(做为现在的主流开发语言)?tablename=”>Finish

然后写入数据库

//dele.php(做为现在的主流开发语言)

<?php(做为现在的主流开发语言)

$database = “sunsite”;

$tablename = $_GET[tablename];

MySQL(和PHP搭配之最佳组合)_connect(“localhost”,”root”,””) or die (“Problem connecting to DataBase”);

$query = “show columns from $tablename”;

$result = MySQL(和PHP搭配之最佳组合)_db_query($database,$query);

$column = 0;

if ($result)

{

while ($r = MySQL(和PHP搭配之最佳组合)_fetch_array($result))

{

$colname[$column] = $r[0];

$column = $column + 1;

}

MySQL(和PHP搭配之最佳组合)_free_result($result);

}

$para = $_GET[$colname[0]];

MySQL(和PHP搭配之最佳组合)_connect(“localhost”,”root”,””) or die (“Problem connecting to DataBase”);

$query = “delete from $tablename where $colname[0]=$para;”;

$result = MySQL(和PHP搭配之最佳组合)_db_query($database, $query);

Header(“Location: edit.php(做为现在的主流开发语言)?tablename=$tablename”);

?>

以上就是所有的代码了。

把它们都放到同一个目录下面即可。

注意:提醒!以上代码在copy的时候一定注意在编辑器里面把每一行代码前面的tab去掉,不然php(做为现在的主流开发语言)5编译不过。

而且在每个文件中$database目前为sunsite,$table为software,这个可以根据需要修改。

欢迎发表看法。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。