I need 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 a solution on a foreign Forum. Here I will localize it.
Two key points
1) define (CLIENT_MULTI_RESULTS, 131072 );
2) $ link = mysql_connect ("127.0.0.1", "root", "", 1, CLIENT_MULTI_RESULTS) or die ("cocould not connect:". mysql_error ());
The following is an example program.
<? Php
Define (CLIENT_MULTI_RESULTS, 131072 );
$ Link = mysql_connect ("127.0.0.1", "root", "", 1, CLIENT_MULTI_RESULTS) or die ("cocould not connect:". mysql_error ());
Mysql_select_db ("vs") or die ("cocould not select database ");
?>
<? Php
$ Result = mysql_query ("call get_news_from_class_id (2)") or die ("Query failed:". mysql_error ());
While ($ row = mysql_fetch_array ($ result, MYSQL_ASSOC ))
{
$ Line = <tr> <td> <a target = _ blank href =. $ row ["url"].>. $ row ["title"]. (. $ row ["page_time"].). </a> </td> </t
R>;
Echo $ line;
Printf ("");
}
Mysql_free_result ($ result );
?>
<? Php
Mysql_close ($ link );
?>