Can php query the results from a previous query?

前端 未结 5 856
梦如初夏
梦如初夏 2021-02-09 03:05

In some languages (ColdFusion comes to mind), you can run a query on the result set from a previous query. Is it possible to do something like that in php (with MySQL as the dat

5条回答
  •  春和景丽
    2021-02-09 03:15

    In PHP, it would be terribly inefficient. You would have to loop through each row and check that its name was trout. However, is there any reason you can't do

    SELECT * FROM `animals` WHERE `type` = 'fish' AND `name` = 'trout'
    

    in SQL? It would be much, much faster.

提交回复
热议问题