In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to modify the database code in php". In the daily operation, I believe many people have doubts about how to modify the database code in php. The editor consulted all kinds of data and sorted out a simple and easy-to-use method of operation. I hope it will be helpful to answer the doubt of "how to modify the database code in php". Next, please follow the editor to study!
Php modify database coding methods: 1, in the mysql database, create a user table; 2, create PHP files and connect to the mysql database; 3, use the mysqli_query function to execute the "set names' utf8'" sql statement, and set the code to connect to the database as utf8.
This article operating environment: Windows7 system, PHP7.1 version, Dell G3 computer.
How does php modify the database code?
Php+mysql sets the encoding of the connection database
In the mysql database, create a user table and insert multiple pieces of data into the table for testing.
Create a test.php file within which you use the header () method to set the encoding format of the page to utf-8.
Within the test.php file, connect to the mysql database and use mysqli_select_db to select the database you want to operate on.
In the test.php file, use the mysqli_query function to execute the "set names' utf8'" sql statement, set the code of the connection database to utf8, and avoid garbled code when inserting Chinese into the database.
Within the test.php file, use update to create a sql statement that changes the username value of the record with id 1 to "test" and executes the sql statement using the mysqli_query function.
Open the test.php file in a browser and view the results in the database.
At this point, the study on "how to modify the database code in php" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.