How to execute two mysql queries as one in PHP/MYSQL?

前端 未结 8 849
误落风尘
误落风尘 2020-11-22 13:19

I have two queries, as following:

SELECT SQL_CALC_FOUND_ROWS Id, Name FROM my_table WHERE Name LIKE \'%prashant%\' LIMIT 0, 10;
SELECT FOUND_ROWS();
<         


        
8条回答
  •  遇见更好的自我
    2020-11-22 13:52

    Like this:

    $result1 = mysql_query($query1);
    $result2 = mysql_query($query2);
    
    // do something with the 2 result sets...
    
    if ($result1)
        mysql_free_result($result1);
    
    if ($result2)
        mysql_free_result($result2);
    

提交回复
热议问题