यह सरल कोड दो MySQL प्रक्रियाओं को कॉल करता है, लेकिन पहले जो मान देता है, वह दूसरी क्वेरी पर एक त्रुटि देता है।PHP सिंक त्रुटि से बाहर संचार
नोट: पहले या दूसरे को चलाने पर प्रत्येक के लिए सही ढंग से वापस आ जाएगा। तो सवाल काम करते हैं, बस एक साथ नहीं।
पूर्ण त्रुटि है: Invalid query: Commands out of sync; you can't run this command now
कोई भी विचार करें।
<?php
require_once ('connection.php');
//First Query and Output
$result = mysql_query("CALL C01_Client_Summary_ByAccount(1, '2012-02-27', '2013-03-29');");
if (!$result) {
die('Invalid query: ' . mysql_error());
}
while($row=mysql_fetch_array($result))
{
echo $row['CommisionPercentage'];
}
mysql_free_result($result);
//END First Query and Output
//Second Query and Output
$new2 = mysql_query("CALL C01_Client_Summary_ByBetType(1, '2012-02-27', '2013-03-29');");
if (!$new2) {
die('Invalid query: ' . mysql_error());
}
while($row=mysql_fetch_array($new2))
{
echo $row['Turnover'];
}
//END Second Query and Output
?>
करता है अपने पहले 'कॉल()' कारण 2 resultsets: यहाँ यह कैसे करना है पर एक अच्छी मिसाल है? – Wrikken
मुझे इस का समाधान मिला, मुझे में कनेक्शन बदलने की आवश्यकता है ('connection.php'); और फिर पहली क्वेरी के बाद कनेक्शन mysql_close ($ con) बंद कर दिया; और फिर दूसरी क्वेरी से पहले कनेक्शन को फिर से खोलें ('connection.php'); – user2162372
देखें http://stackoverflow.com/q/614671/632951 – Pacerier