Why does mysql_query() return TRUE with a SELECT statement?

后端 未结 7 1805
日久生厌
日久生厌 2020-12-20 15:24

According to the manual of mysql_query() and to everything I know about this function that I used so many times, it can either return a resource or FALSE if the

7条回答
  •  余生分开走
    2020-12-20 15:39

    You haven't mentioned data lengths but you should check to see if this is called by an exceeding of max_allowed_packet.

    When a MySQL client or the mysqld server receives a packet bigger than max_allowed_packet bytes, it issues a Packet too large error and closes the connection. With some clients, you may also get a Lost connection to MySQL server during query error if the communication packet is too large.

    [...]

    Both the client and the server have their own max_allowed_packet variable, so if you want to handle big packets, you must increase this variable both in the client and in the server.

    http://dev.mysql.com/doc/refman/5.5/en/packet-too-large.html

    Not sure how mysql_query return value is affected by this but it's worth investigating. Setting it in my.cnf to see if it fixes the problem would be the best place to start.

提交回复
热议问题