Questions tagged [mysqli-multi-query]

Use this tag in case of multi-query execution in mysqli. mysqli_multi_query() executes one or multiple queries which are concatenated by a semicolon and returns TRUE on success or FALSE on failures.

mysqli_multi_query() executes one or multiple queries which are concatenated by a semicolon and returns TRUE on success or FALSE on failures. This can be performed either as procedural style or OOP style(see usage section).

Usage

Object oriented style

bool mysqli::multi_query ( string $query )

Procedural style

bool mysqli_multi_query ( mysqli $link , string $query )
  • bool is the return value type and depends on the passed $variable.
  • mysqli:: refers to the object initialised using stmt_init() or mysqli_prepare() call.
  • $query is the query, as a string. Data inside the query should be properly escaped.

Miscellaneous

  • mysqli_query() - Performs a query on the database
  • mysqli_use_result() - Initiate a result set retrieval
  • mysqli_store_result() - Transfers a result set from the last query
  • mysqli_next_result() - Prepare next result from multi_query
  • mysqli_more_results() - Check if there are any more query results from a multi query

Related tag

173 questions
1
vote
1 answer

php mysqli_multi_query not getting data

I try results from db for autocomplete search. I use this code for getting names, in db I have a row with four columns that can contain the searched keyword. function search_results($conn,$str){ $sql = "SELECT g_custom_1 as str FROM gallery WHERE …
1
vote
1 answer

Already registered user is not working

Why it is showing a blank page insted of SORRY...YOU ARE ALREADY REGISTERED USER... when i am supplying the same email that is already registered. connect.php
1
vote
1 answer

Run multiple CREATE TABLe queries with MySQL and PHP

I need to create a large number of tables at once and add data to the first one using PHP and MySQL. My code looks like this: $sql = "CREATE TABLE table1 ( code VARCHAR(5) PRIMARY KEY, name VARCHAR(50) NOT NULL );"; //adding businesses to…
Maddy
  • 35
  • 3
1
vote
1 answer

Why this PHP error occurs: "Strict standards: mysqli::next_result(): There is no next result set."?

I have code, which is basically a copy of a php.net's code, but for some reason it does not work. Here is the code on php.net:
Michael Haddad
  • 4,085
  • 7
  • 42
  • 82
1
vote
1 answer

How to select ids that a user has not viewed

In my notification current the day I used a view column in update table which update view = 1 if viewed else view = 0 . But in case for make notification for many user for a particular update, its cannot work if a user viewed first. So I create that…
koc
  • 955
  • 8
  • 26
1
vote
4 answers

Mysql - How to query a mysqli_multi_query() to return the entire row

My select: $query = "SELECT * FROM user where userID='1';"; within my mysqli_multi_query() is not returning the entire row, it only returns a single column. This is my result: 1-----------------book1 book3 book4 But this is what I want: 1 John…
hmzfier
  • 554
  • 9
  • 21
1
vote
1 answer

mysqli_insert_id failed with mysqli_multi_query

Project: Duplicate row data across multiple related tables. Problem: In php, I don't seemed to be able to get the id result from mysqli_insert_id after using the 1st mysqli_multi_query. Status: I've successfully queried the following using…
cpardon
  • 487
  • 4
  • 24
1
vote
0 answers

mysqli transaction with both prepared statement and multi_query

I'm facing a strange issue with a transaction, this is the code: $mysqli = $this->getMysqli(); //Avoid Autocommitting $mysqli->autocommit(FALSE); $mysqli->begin_transaction(); $insertStatment = $mysqli->prepare('INSERT INTO…
0plus1
  • 4,475
  • 12
  • 47
  • 89
1
vote
1 answer

How to execute custom delimiter query with mysqli multiquery

I have the following sql script and I want to execute it with multi-query DELIMITER $$ DROP FUNCTION IF EXISTS `getAttendanceHistoryDates`$$ CREATE FUNCTION getAttendanceHistoryDates(processDate date) RETURNS TEXT DETERMINISTIC LANGUAGE…
ssrp
  • 1,126
  • 5
  • 17
  • 35
1
vote
2 answers

MYSQL NEIGHBOUR ROWS along with CURRENT ROW

MYSQL query to fetch the neighbour rows along with the present(id) given condition like ID | BOOK | -------------- 1 | xyzbooks | 2 | pqrbooks | 3 | dnsaddds | 4 | dfbsakjf | 5 | dbsadbdd | 6 | tyrbooks | 7 | sfdffdsf | 8 |…
1
vote
0 answers

How to create a view with mysqli_multi_query?

I'm developing a PHP application, that should be able to setup a project database and update it / its data definition, using a list of SQL files. Here is a first naïve quick&dirty written procedural prototype:
automatix
  • 14,018
  • 26
  • 105
  • 230
1
vote
2 answers

How to get the resultset from a SELECT query using mysqli_multi_query()?

My queries are: CREATE TEMPORARY TABLE `hcaconsumptions_temp` ( `DeviceID` INT (11) NOT NULL, `TimeStamp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `Consumption` FLOAT NOT NULL, `DeviceBrand` VARCHAR…
ilhan
  • 8,700
  • 35
  • 117
  • 201
1
vote
3 answers

Php multiple mySQL query

is it possible to retrieve an array of data from more than one table within one query? For example , I am getting an array from table1, but I want to retrieve data from several other tables too:
friendlygiraffe
  • 871
  • 2
  • 6
  • 18
0
votes
1 answer

php mysqli oo multi_query over an array

I have a $color_combo value which explodes into an array of $colors for a given item (3 values in the array). The $colors values are 3-character string codes i.e. FGR and there is a lookup table in the db that matches that code to the color 'forest…
shotdsherrif
  • 433
  • 2
  • 10
  • 20
0
votes
0 answers

Mysqli Multi Query in OOPs PHP

I don't Understand What is the problem in this code. everything is ok but query didn't execute with multi query. On the other hand every code is working but only this multi query not working // database connection $mysqli = new mysqli(DATABASE_HOST,…
Beast69
  • 1
  • 1
  • 3