betons Posted December 3, 2007 Report Share Posted December 3, 2007 (edited) Tātad izveidoju Stord procedure: CREATE PROCEDURE `cc`() BEGIN SELECT * FROM t1; SELECT * FROM t2; END MySQL query browserī palaižu call cc(); un tur man atgriež 2 dataset. PHP mysql_query('call cc()') rāda ka nevar atgriezt nekādu rezultātu. Tātad jautājums tāds: Kā var izsaukt šo procedūru ar PHP un kā tikt pie abiem datasetiem? Edited December 3, 2007 by betons Link to comment Share on other sites More sharing options...
andrisp Posted December 3, 2007 Report Share Posted December 3, 2007 (edited) Cik zinu, tad ar php mysql moduli nekā. Ar mysqli gan izskatās savādāk: http://lv.php.net/manual/en/function.mysqli-use-result.php Edited December 3, 2007 by andrisp Link to comment Share on other sites More sharing options...
betons Posted December 3, 2007 Author Report Share Posted December 3, 2007 Jā, to es arī lēnām sāku saprast ka ar mysql nevar, laikam tikai ar mysqli var. Beidzot izdevās izveidot kodu, kurš veiksmīgi izvada abu procedūras SELECT rezultātus, ja kādam interesē, tad viņš izskatās šāds: <?php $mysqli = new mysqli("localhost", "root", "", "test"); $query='call cc();'; if ($mysqli->multi_query($query)) { do { if ($result = $mysqli->use_result()) { while ($row = $result->fetch_row()) { print_r($row); echo '<br>'; } $result->close(); } if ($mysqli->more_results()) {echo '<hr>';} } while ($mysqli->next_result()); } $mysqli->close(); ?> Link to comment Share on other sites More sharing options...
Recommended Posts