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
0
votes
3 answers

Rerequesting posts from mysql database social network site

I am working on a social network website project. I have created database and everything. The posts table has a preference column which stores the preference value according to the likes and comments that a post gets from the users and also the time…
The Coder
  • 121
  • 1
  • 7
0
votes
5 answers

Mysqli query performance multi-query

I was just hoping someone could help me speed up 4 queries with a multi query. GOAL: a single multi query to function as the single queries below. Simple queries, i am checking one table to see if user is banned, then if not, i am getting row for…
ShawnDaGeek
  • 4,145
  • 1
  • 22
  • 39
0
votes
1 answer

mysql query work on phpmyadmin but not work on mysqli

I have a Query That work in phpmyadmin but not work on php (mysqli) where is the problem ? Query: INSERT INTO `SepidarSoft_Portal`.`Archive_Media` SET `CTime`='1364135670',`UTime`='1364135670',`PID`='',`State`='1',`Sequence`='0',`Subject`='Hojom…
mohammad mohsenipur
  • 3,218
  • 2
  • 17
  • 22
0
votes
3 answers

Cant get array to work from query

I need the result from a query to become an array and use that array to pull data from the database on a second php mysqli query.
Samuel Ramzan
  • 1,770
  • 1
  • 15
  • 24
0
votes
1 answer

zend framework 2 Authentication with mysqli fail

I have followed the zend instructions for implement my web Authentication using a database table with Mysqli driver configured. When render the page, the following exceptions appears after execute authenticate method: …
josepmra
  • 617
  • 9
  • 25
0
votes
1 answer

mysqli_ping breaks mysqli_multi_query

I have a nice function called lnk() that I have been using for a very long time that connects to MySQL. Recently I decided to add to it the mysqli_ping call to check the connection and reconnect if need be as I was experiencing issues with a daemon…
transilvlad
  • 13,974
  • 13
  • 45
  • 80
-1
votes
1 answer

mysql_connect() does connect to MySQL

I am in a terrible situation. My PHP works with MySQL database when I use MySQLi connection code, but when I try to connect the database using
-1
votes
1 answer

which quotes should be used to write a WHERE clause in this php mysqli query?

In phpMyAdmin SQL works fine with a WHERE clause in double quotes: SET @sql = NULL; SELECT GROUP_CONCAT(DISTINCT CONCAT('max(case when category = ''', category, ''' then status end) ',category)) INTO @sql FROM Meeting; SET @sql = CONCAT('SELECT…
-1
votes
1 answer

mysqli error only on subsequent calls to same function - 'there is no next result set.'

I am iterating rows of a csv file. On row 1, I call stored procedure (import_extended_data_sp) and it succeeds. On row 2, the call fails with : Strict Standards mysqli::next_result(): There is no next result set. However, with the call being…
SimonB
  • 962
  • 1
  • 14
  • 36
-1
votes
1 answer

mysqli_multi_query - Separate results into columns

I have seven SQL queries that are being executed using the mysqli_multi_query function: if (mysqli_multi_query($conn, $airlinesql)) { do { if ($result = mysqli_store_result($conn)) { while ($row = mysqli_fetch_row($result)) { …
-1
votes
1 answer

Am I using multi_query() in php wrong?

I'm trying to get an echo of the column names (except the first column) of a table from my database. I used the code below. In my div I get the echo "Cannot get xValues". So it seems that my query doesn't work from the very start. Note however that…
-1
votes
1 answer

prepare SQLite insert statement inside php for loop

I want to prepare an SQL insert statement inside PHP for loop, my statement is something like this $insert_stmt = ""; for($x=1; $x<=$all_property[duration]; $x++) { $insert_stmt .= "INSERT INTO `schedule` VALUES ($all_property[serial],…
Nilesh
  • 73
  • 6
-1
votes
1 answer

I got one error"Commands out of sync; you can't run this command now" when I using mysqli_multi_query

I want to excute two update sql by using $mysqli->multi_query($sql);But I just get this error info below: PHP message: UPDATE table1 SET status=1;UPDATE table2 SET name='b'|Commands out of sync; you can't run this command now" while reading…
-1
votes
1 answer

php mysqli multi_query - ignore second query

If I execute example.php, everything looks fine, but the second query (with a2,b2,c2) is not inserted into my table. I tried more queries, but it is always the second which is "ignored". Is it bug, feature or my mistake..? PHP v5.3.3, MySQL…
pEpe
  • 31
  • 6
-1
votes
1 answer

insert all records in a single query does not work

I'm wondering why the following PHP Code does not insert values into database? I'm trying to insert ten datasets into a table with one execution (=multiple rows in single query), but after execution, the table is still empty.
Peter
  • 1,224
  • 3
  • 16
  • 28