Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use the mysqli_query () function in PHP

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

This article uses easy-to-understand examples to introduce how to use the mysqli_query () function in PHP, the content is very detailed, interested friends can refer to, hope to be helpful to you.

First, using PHP coding, I have the following mySQL table:

CREATE TABLE `students` (`ID` int (10) NOT NULL AUTO_INCREMENT, `Name` varchar (255) DEFAULT NULL, `Start` int (10) DEFAULT NULL, `End` int (10) DEFAULT NULL, PRIMARY KEY (`ID`)) ENGINE=InnoDB

Try to use the mysqli_query function in PHP to describe the table.

Code:

$link = mysqli_connect ($DB_HOST, $DB_USER, $DB_PASS, $DATABASE); $result = mysqli_query ($link, "DESCRIBE students")

The document says that for successful SELECT,SHOW,DESCRIBE or EXPLAIN queries, mysqli_query () will return

Mysqli_result object.

But from there I don't know how to print $result to display the query results. If possible, I'd like to print $result to make it look like:

+-+ | Field | Type | Null | Key | Default | Extra | +- +-+ | ID | int (10) | NO | PRI | NULL | auto_increment | | Name | varchar | YES | | NULL | | Start | int (10) | YES | | NULL | | End | int (10) | YES | | NULL | | +-+-+

Another problem I have is how to print the query SHOW CREATE TABLE students.

$result = mysqli_query ($link, "SHOW CREATE TABLE students"); on how to use the mysqli_query () function in PHP to share here, I hope the above content can be helpful to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report