簡體   English   中英

如何在MultiQuery MySQLi和PHP中識別特定的select語句

[英]How to identify a particular select statement in multiquery mysqli and php

我創建了一個存儲過程,其中包含PHP中的多個select查詢。 我正在使用mysqli_multi_query調用該過程,並且正在使用mysqli_store_result存儲選擇查詢的結果。

問題是我想識別選擇查詢,哪個選擇查詢正在獲取結果,我想對其進行唯一標記

您可以為每個查詢添加一個額外的列,如下所示:

select 'query_tag_1' as tag, ...
from your_table;

select 'query_tag_2' as tag, ...
from your_table;

select 'query_tag_3' as tag, ...
from your_table;

您可以從PHP檢查tag列的值。

更新 :另一種方法是重命名列(例如第一個):

select id as id_tag1, ...
from your_table;

select id as id_tag2, ...
from your_table;

select id as id_tag3, ...
from your_table;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM