php - mysql procedure return only one/first row -
i'm trying 100 time find out reason why code give output first row. made 1 procedure select products , called in php in way:
$query = "call create_helper()"; $exec = mysql_query( $query, $connexion ); while($row = mysql_fetch_row($exec)) { var_dump( $row ); } create procedure create_helper () begin declare prod cursor select id pc; ... open prod; pd_loop: loop fetch pd id_s; if finished = 1 leave pd_loop; end if; select name, ag, pdt, pname clt id = id_s; ... end loop pd_loop; close prod; end;
the procedure under mysql works fine , 1 problem in php. shows first row.
try
returns numerical array of strings corresponds fetched row, or false if there no more rows.
mysql_fetch_row() fetches 1 row of info result associated specified result identifier. row returned array. each result column stored in array offset, starting @ offset 0.
mysql_fetch_array() fetch result row associative array, numeric array , fetches both associative & numeric array. <?php $query = "call create_helper()"; $exec = mysql_query( $query, $connexion ); while($row = mysql_fetch_array($exec)) { var_dump($row); } ?>
php mysql stored-procedures
No comments:
Post a Comment