PHP implements method to detect whether mysql table exists

墨辰丷
Release: 2023-03-26 20:04:02
Original
939 people have browsed it

This article mainly introduces the method of PHP detecting the existence of mysql table. It summarizes and analyzes the method of PHP using pdo connection and mysql function to determine the existence of mysql table in the form of examples. Friends who need it can refer to it

pdo:

getMessage()); } $table = 'cy_news'; //判断表是否存在 $result = $pdo->query("SHOW TABLES LIKE '". $table."'"); $row = $result->fetchAll(); if('1' == count($row)){ echo "Table exists"; } else { echo "Table does not exist"; } ?>
Copy after login

##mysql:

Copy after login

Related recommendations:

Detailed explanation of the database being unable to start due to damage to the MySQL table data file

How to usemysql tableConnection

##Use php to query

mysql tableSummary of whether it exists

The above is the detailed content of PHP implements method to detect whether mysql table exists. 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!