Home  >  Article  >  Backend Development  >  PHP calls a stored procedure to return a result set, solve cant return a result set in_PHP tutorial

PHP calls a stored procedure to return a result set, solve cant return a result set in_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:35:17876browse

You need PHP to call a stored procedure and return a result set. I found it very difficult. After searching for a long time, I finally found a solution on a foreigner’s forum. Let’s localize it here.

The key is two points

1) define(CLIENT_MULTI_RESULTS, 131072);

2) $link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());


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

define(CLIENT_MULTI_RESULTS, 131072);

$link = mysql_connect("127.0.0.1", "root", "",1,CLIENT_MULTI_RESULTS) or die("Could not connect: ".mysql_error());
mysql_select_db("vs") or die("Could not select database");
?>

& lt;? PHP
$ result = mysql_query ("call get_news_from_id_id (2)") ORe ("query failed:" .mysql_error ()); _Fetch_array ($ result, MYSQL_ASSOC))
                                                                                                          $line = .$row["title"].( .$row["page_time"].).r>;
echo $line;
printf(" ");

}

mysql_free_result($result);

?>

mysql_close($link);

?>

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

truehttp: //www.bkjia.com/PHPjc/508368.htmlTechArticleNeed PHP to call the stored procedure and return a result set. I found it very difficult. After searching for a long time, I finally found it on the foreigner's forum. Found the solution on the website, localize it here. The key points are two points 1)...
Statement:
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