Home>Article>Backend Development> How to set table prefix in php

How to set table prefix in php

藏色散人
藏色散人 Original
2020-08-19 09:26:32 2776browse

How to set the table prefix in php: first enter the database user name and password; then connect to the database; then modify the table prefix through the "str_replace($seach,$replace,$name['0']);" statement. Can.

How to set table prefix in php

Recommended: "PHP Video Tutorial"

php batch change database table prefix

We often encounter the problem of replacing or adding database table prefixes. Exporting the database, making batch changes on Notepad, and then exporting is also a method, but it is not convenient enough.

It can be easily done through the following method. The code is as follows, if you find it useful, please give me some advice.

If you add a prefix, you only need to change it a little

$table = str_replace($seach,$replace,$name['0']);换成 $table = $replace.$name['0'];

.

The above is the detailed content of How to set table prefix in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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