PHP calls a stored procedure to return a result set, and solves the problem of cant return a result set in the given conte_PHP tutorial

WBOY
Release: 2016-07-13 17:33:17
Original
1215 people have browsed it

Requires PHP (as the current mainstream development language)Call the stored procedure and return a result set. I found it very difficult. After searching for a long time, I finally found the solution on the foreigner's forum. Localization here one time.

The key is two points

1) define(CLIENT_MULTI_RESULTS, 131072);

2) $link = MySQL(The best combination with PHP)_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".MySQL(The best combination with PHP)_error() );


The following can be used normally. The following is an example program.

(as the current mainstream development language)
define(CLIENT_MULTI_RESULTS, 131072);

$link = MySQL(The best combination with PHP)_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".MySQL( The best combination with PHP)_error());
MySQL(The best combination with PHP)_select_db("vs") or die("Could not select database" );
?>

                                                                      Combination)_query("call get_news_from_class_id(2)") or die("Query failed:" .MySQL(The best combination with PHP)
_error()); while( $row = MySQL(The best combination with PHP)_fetch_array($result, MySQL(The best combination with PHP)
_ASSOC)) { $line = .$row["title"].(.$row["page_time"].) .r>; echo $line;
printf(" ");

}
MySQL
(The best combination with PHP)

_free_result($result);

?>

(as the current mainstream development language)

MySQL

(the best combination with PHP)_close($link); ?>

http://www.bkjia.com/PHPjc/508628.html

www.bkjia.com

http: //www.bkjia.com/PHPjc/508628.htmlTechArticle requires PHP (as the current mainstream development language) to call the stored procedure and return a result set. I found it very difficult. After searching for a long time, I finally found the solution on the foreigner’s forum, here is the local...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!