How to delete data table using PHP script

WJ
Release: 2023-03-01 09:56:02
Original
2731 people have browsed it

How to delete data table using PHP script

How to use PHP script to delete a data table:

Deleting a data table in MySQL is very easy to operate, but you can delete the table again Be very careful while doing this because all data will disappear after executing the delete command.

The following is the general syntax for deleting MySQL data tables:

DROP TABLE table_name ;
Copy after login

Use PHP script to delete data tables

PHP uses the mysqli_query function to delete MySQL data tables.

This function has two parameters and returns TRUE when executed successfully, otherwise it returns FALSE.

Grammar

mysqli_query(connection,query,resultmode);
Copy after login
'; $sql = "DROP TABLE runoob_tbl"; mysqli_select_db( $conn, 'RUNOOB' ); $retval = mysqli_query( $conn, $sql ); if(! $retval ){ die('数据表删除失败: ' . mysqli_error($conn));} echo "数据表删除成功\n";mysqli_close($conn);?>
Copy after login

Related references:php中文网

The above is the detailed content of How to delete data table using PHP script. For more information, please follow other related articles on the PHP Chinese website!

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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!