How to Run Multiple Queries at Once in OOP
Note:The SQL Queries Shld be seperated by Semicolon(;)

$Conn = $this->dbConnect;
$strSQL = "SELECT name FROM tbSample1;";
$strSQL = $strSQL."SELECT age FROM tbSample1;";

if ($Conn->multi_query($strSQL)) 
{
	 do 
	 { 
		/* store first result set */
		if ($result = $Conn->store_result()) 
		{	
			while ($row = $result->fetch_row()) 
			{
				$item = array();
				$item = $row;
				$arrTempCounts[] = $item;
			}
			$result->free();
		}
		/* print divider */

		if ($Conn->more_results()) 
		{
		 print("-----------------n");
		}
	}while ($Conn->next_result());
}

Posted in PHP.

Leave a reply