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 solve the problem of php query failure

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "how to solve the problem of php query failure". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

The solution to the failure of php query: 1, use the function "mysql_select_db ('demo');" select query database; 2, add a database resource connector to mysql_query.

This article operating environment: Windows7 system, PHP7.1 version, DELL G3 computer

What if the php query fails?

The specific problems are described as follows:

Php+mysql! The connection succeeded, but the query failed! The detailed code is as follows: mysql local student table also has data, can be queried in mysql but not queried by mysql, showing that the query failed my platform is win7 + apache + mysql + php! Thank you! wait online! Ladies and gentlemen, thank you for your help. I am poor and still hope that Haihan has pure technical problems. If you change the lingquery statement to show databases, you can see the four databases, which are infomation_schemademomysqltest, but after connecting to the demo database, querying the student table shows that the query failed, but there is content in the student table.

Solution:

There are two reasons for failure:

1. Mysql_connect ('127.0.0.1: 3306)

The demo here is the database to which you cannot connect. The function mysql_select_db ('demo') should be used

2. Mysql_query ("select * from student") or die ("query failed")

The mysql_query here requires a database resource connector (that is, $mysql)

If the above two points are corrected, there should be no mistake!

This is the end of "how to solve the problem of php query failure". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

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

12
Report