lmbs PHP,PHP 清空 MySql 指定数据表中的所有数据
PHP 清空 MySql 指定數(shù)據(jù)表中的所有數(shù)據(jù)
PHP 清空 MySql 指定數(shù)據(jù)表中的所有數(shù)據(jù),在烈火小編在網(wǎng)上閑逛時(shí),這是某技術(shù)博客的一篇文章,說是文章,并沒有文字,只有代碼,經(jīng)過測試可以使用,現(xiàn)在分享給大家。
共有三個(gè)文件,其實(shí)也可以合并寫成一個(gè)。
1.conn.php:
Copy to Clipboard
引用的內(nèi)容:[www.veryhuo.com]
$id=mysql_connect("localhost","root","mysql") or die('連接失敗:' . mysql_error());
if(mysql_select_db("phpjcdb",$id)) //說明:phpjcdb 是數(shù)據(jù)庫名稱
echo "";
else
echo ('數(shù)據(jù)庫選擇失敗:' . mysql_error());
mysql_query("set names gb2312"); //設(shè)置為簡體中文
?>
2.index.php:
Copy to Clipboard
引用的內(nèi)容:[www.veryhuo.com]
include("conn.php");
?>
清空指定數(shù)據(jù)表中的所有數(shù)據(jù)function deletes(){
if (window.confirm('確定要?jiǎng)h除該記錄??')==true){
return true;
}else{ return false;}
}
| ? | ? | ? | ? |
| ? | $result = mysql_list_tables ("db_database06"); $i = 0; while ($i < mysql_num_rows ($result)) { $tb_names = mysql_tablename ($result, $i); ?> ? | ? | |
| ? | ? | ? | ? |
| ? | if($_POST['Submit2']=="提交"){ $select = $_POST['select']; $query1=mysql_query("select * from $select"); $query2=mysql_query("select * from $select"); $myrow=mysql_fetch_row($query2);?> |
| ?<?php echo $myrow[$i];?> |
method="post" name="form2" id="form2" onSubmit="return deletes();">
3.index_ok.php:
Copy to Clipboard
引用的內(nèi)容:[www.veryhuo.com]
session_start();
include("conn.php");
if($_POST['Submit']==true){
$lmbs = $_GET['lmbs'];
$result=mysql_query("delete from $lmbs");
if($result==true){echo "刪除成功!";}else{echo "刪除失敗!!";}
}
?>
/php/12290.htmlwww.phpzy.comtrue/php/12290.htmlTechArticlePHP 清空 MySql 指定數(shù)據(jù)表中的所有數(shù)據(jù) PHP 清空 MySql 指定數(shù)據(jù)表中的所有數(shù)據(jù),在烈火小編在網(wǎng)上閑逛時(shí),這是某技術(shù)博客的一篇文章,說是文章,并沒有文字,只有代碼,經(jīng)過測試可...
總結(jié)
以上是生活随笔為你收集整理的lmbs PHP,PHP 清空 MySql 指定数据表中的所有数据的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 轻网站怎么建立()
- 下一篇: php 谷歌语音,php 语音参考