简体   繁体   中英

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

I have created a stored procedure which contains multiple select query in PHP. I am using mysqli_multi_query to call the procedure and I'm using mysqli_store_result to store the result of select query.

Question is that I want to identify the select query, which select query is getting the result, I want to tag it uniquely

You can add an extra column to each query, like this:

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;

You can check the value of tag column from PHP.

Update : Another way would be to rename a column (the first for example):

select id as id_tag1, ...
from your_table;

select id as id_tag2, ...
from your_table;

select id as id_tag3, ...
from your_table;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM