{"id":614,"date":"2012-07-20T15:09:43","date_gmt":"2012-07-20T15:09:43","guid":{"rendered":"http:\/\/codeatelier.wordpress.com\/?p=106"},"modified":"2012-07-20T15:09:43","modified_gmt":"2012-07-20T15:09:43","slug":"running-multiple-sql-queries-from-php","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/running-multiple-sql-queries-from-php\/","title":{"rendered":"Running Multiple SQL Queries From PHP"},"content":{"rendered":"<p><strong>How to Run Multiple Queries at Once in OOP<\/strong><br \/>\nNote:The SQL Queries Shld be seperated by Semicolon(;)<\/p>\n<pre>\n$Conn = $this-&gt;dbConnect;\n$strSQL = \"SELECT name FROM tbSample1;\";\n$strSQL = $strSQL.\"SELECT age FROM tbSample1;\";\n\nif ($Conn-&gt;multi_query($strSQL)) \n{\n\t do \n\t { \n\t\t\/* store first result set *\/\n\t\tif ($result = $Conn-&gt;store_result()) \n\t\t{\t\n\t\t\twhile ($row = $result-&gt;fetch_row()) \n\t\t\t{\n\t\t\t\t$item = array();\n\t\t\t\t$item = $row;\n\t\t\t\t$arrTempCounts[] = $item;\n\t\t\t}\n\t\t\t$result-&gt;free();\n\t\t}\n\t\t\/* print divider *\/\n\n\t\tif ($Conn-&gt;more_results()) \n\t\t{\n\t\t print(\"-----------------n\");\n\t\t}\n\t}while ($Conn-&gt;next_result());\n}\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>How to Run Multiple Queries at Once in OOP Note:The SQL Queries Shld be seperated by Semicolon(;) $Conn = $this-&gt;dbConnect; $strSQL = &#8220;SELECT name FROM tbSample1;&#8221;; $strSQL = $strSQL.&#8221;SELECT age FROM tbSample1;&#8221;; if ($Conn-&gt;multi_query($strSQL)) { do { \/* store first result set *\/ if ($result = $Conn-&gt;store_result()) { while ($row = $result-&gt;fetch_row()) { $item =&hellip; <a href=\"https:\/\/codethataint.com\/blog\/running-multiple-sql-queries-from-php\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[93],"tags":[],"class_list":["post-614","post","type-post","status-publish","format-standard","hentry","category-php"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/614","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=614"}],"version-history":[{"count":0,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/614\/revisions"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=614"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=614"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=614"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}