Home > Backend Development > PHP Tutorial > PHP clear all data in MySql specified data table_PHP tutorial

PHP clear all data in MySql specified data table_PHP tutorial

WBOY
Release: 2016-07-21 14:53:46
Original
1373 people have browsed it

PHP clears all the data in the MySql specified data table. When the editor of Agni was wandering around the Internet, this was an article from a technical blog. It was said to be an article. There was no text, only code. After testing, it worked Use it and share it with everyone now.

There are three files in total, but they can also be merged into one.

1.conn.php:

Copy to ClipboardLiehuo.Net CodesQuoted content: [www.bkjia.com] $id=mysql_connect("localhost","root","mysql") or die('Connection failed:' . mysql_error());
if(mysql_select_db("phpjcdb",$ id)) //Explanation: phpjcdb is the database name
echo "";
else
echo ('Database selection failed:' . mysql_error());
mysql_query("set names gb2312") ; //Set to Simplified Chinese
?>

2.index.php:

Copy to ClipboardLiehuo.Net CodesQuoted content: [www.bkjia.com] include("conn.php");
?>



Clear all data in the specified data table




















< ;/tr>
< /td>
< /td>
< ;/td>







< ;/table>

method="post" name=" form2" id="form2" onSubmit="return deletes();">


if($_POST['Submit2']=="Submit"){
$select = $_POST['select'];
$query1=mysql_query("select * from $select");
$query2=mysql_query("select * from $select");
$myrow =mysql_fetch_row($query2);?>











< ?php } } ?>








3.index_ok.php:

Copy to ClipboardLiehuo.Net CodesQuoted content: [www.bkjia.com] session_start();
include("conn.php");
if($_POST['Submit']==true){
$lmbs = $_GET[' lmbs'];
$result=mysql_query("delete from $lmbs");
if($result==true){echo "Delete successfully!";}else{echo "Delete failed!!"; }
}
?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/364716.htmlTechArticlePHP clears all the data in the MySql specified data table. When the editor of Agni was wandering around on the Internet, this was a certain technology An article on the blog, said to be an article, does not have text, only code, after...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template