Other queries cannot be made after the stored procedure is used in the CI framework.

Source: Internet
Author: User
Tags php error
After using a stored procedure in the CI framework, you cannot perform other queries. the MYSQL stored procedure cannot be called under the CI. the connection must be released before other queries can be executed again. However, an error occurred after I release the connection. the code is as follows: obtain node information & nbsp; & nbsp; no other queries can be performed after the stored procedure is used in the CI framework of the stored procedure.
When I call the MYSQL stored procedure under CI, the connection must be released before other queries can be executed again. However, an error occurred while releasing the connection here. the code is as follows:
// Obtain node information
// Execute the stored procedure
$ Query = $ this-> db-> query ("call ws_node_one ($ id )");
$ Data ['node'] = $ query-> result_array () [0];
$ This-> db-> close (); // close the connection
$ This-> load-> database (); // Optional. it is automatically connected when $ this-> db is called under CI.
// The following is a new query
$ Result = $ this-> db-> get_where ("ws_node", array ("id" => $ pid); // An error is returned for this query.

#######################################
The error is as follows:
A php Error was encountered

Severity: 8192

Message: mysql_escape_string (): This function is deprecated; use mysql_real_escape_string () instead.

Filename: mysqli/mysqli_driver.php

Line Number: 320


######################################## #####
The subsequent query results, but the call to the mysql_escape_string () character escape function failed. I don't know why. change mysql_escape_string to callback in mysqli/mysqli_driver.php as required, the error mysql_real_escape_string is returned.


######################################## ######
Solution !!!
CI Xiaobai
------ Solution ----------------------
Mysql extension can be performed only after the database is disconnected after the stored procedure is executed.
Therefore, mysql is lagging behind and should be eliminated.

You can use mysqli or PDO extension instead.
------ Solution ----------------------
Mysql extension functions have been deprecated since 5.5.0. replace them with mysqli and pdo.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.