Home > Backend Development > PHP Tutorial > php中MYSQL TRUNCATE的使用

php中MYSQL TRUNCATE的使用

WBOY
Release: 2016-06-23 13:47:55
Original
1064 people have browsed it

MySQL TRUNCATE TABLE in PHP

<?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);?>
Copy after login


Related labels:
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