Home > php教程 > PHP开发 > Use of MYSQL TRUNCATE in php

Use of MYSQL TRUNCATE in php

高洛峰
Release: 2016-11-29 14:59:49
Original
1836 people have browsed it

MySQL TRUNCATE TABLE in PHP


$host="localhost";
$username="user";
$password="mysql_password";
$database="database_name";
$table="table_name";

$connection = mysql_connect("$host", "$username", "$password") or die ("Unable to connect to server");
mysql_select_db("$database") or die ("Unable to select database");
$sql = "TRUNCATE TABLE `$table`";
mysql_query($sql);
echo "Table Deleted";
mysql_close($connection);
?>


Related labels:
php
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
Latest Issues
php data acquisition?
From 1970-01-01 08:00:00
0
0
0
PHP extension intl
From 1970-01-01 08:00:00
0
0
0
How to learn php well
From 1970-01-01 08:00:00
0
0
0
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template