I have a procedural php script which employs a mysqli_multi_query statement into which I must now add a SELECT
statement. After many attempts, I have to admit that this appears to be a bit outside my ken. I need some help with the grammar… or perhaps the procedure:
The code has SELECT
ed nothing to this point, and therefore has never needed its results to be queried. How would I retrieve a single result?
Here is my script. I have omitted the details of the other queries.
INSERT INTO table1 ...;
SELECT LAST_INSERT_ID() INTO @varX;
INSERT INTO table2 ...;
INSERT INTO table3 ...;
INSERT INTO table4 ...;
DELETE FROM table0;
SELECT `id` FROM subscribers WHERE `column` = @varX;
I want that last statement's id
from SELECT id FROM patronsSubscr WHERE column = @varX;
They are run from php using this function:
$result = mysqli_multi_query($connection,$sql)
or die("Error.");
I have been trying to use variations of this, with no luck:
while($resultNexts = mysqli_next_result($result)){
// output
}
Any help would be appreciated. Please let me know if I can provide any more information.