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
-2
votes
1 answer

MySQLi_Connect cannot update field for multiple rows of sql table at same time

In my php code, I am trying to update all rows of an sql database table that have a particular value for 2 different fields/columns. When I run the code, the updates are not being made to the sql table. Assume I have a database called "databasename"…
user3882316
  • 25
  • 1
  • 4
-2
votes
2 answers

How I can execute many queries in one page?

I write this code but when I run it no output. There is no error but the problem no output. How I can execute many queries in the same page? tran
Farhan
  • 21
  • 1
  • 1
  • 4
-2
votes
1 answer

insert then select from single query sql/mysql/mysqli

I want to execute 2 queries: query1 = "insert into country(id, country)value('UDC:123', 'India')"; query2 = "select * from country"; I tried this mysqli_multi_query but it didn't work.
Hemant Maurya
  • 136
  • 1
  • 1
  • 14
-2
votes
1 answer

tell me why this is only returning 1 result

$sql="SELECT * FROM oc_category where parent_id = '253' "; // grab the category id from the parent id $result=mysqli_query($con,$sql); $Pid=mysqli_fetch_assoc($result); $sql="SELECT * FROM oc_category_description where category_id =…
NotThatGuy
  • 11
  • 1
-2
votes
1 answer

How to convert simple MySQL example to MySQLi object oriented style?

How to convert this simple MySQL example to MySQLi object oriented style: $query = mysql_query("SELECT id, name FROM fruits WHERE `group`=''"); if ($query) { while ($row = mysql_fetch_array($query, MYSQL_ASSOC)) { echo $row['name']; …
Binyamin
  • 7,493
  • 10
  • 60
  • 82
-3
votes
1 answer

PHP `mysqli_multi_query` cannot return a value

A simple example $connection = mysqli_connect("domain", "user", "psw", "db"); $response = mysqli_multi_query($connection, " SET @a = 'foo'; SET @b = 'bar'; SELECT @a AS A, @b AS…
Genken
  • 23
  • 5
-3
votes
1 answer

Using last inserted id in mysql multi query

I am trying to use last inserted id in MySQL muli_query but I don't know what I missed this is my code : $query = "INSERT INTO posts (nparc,id_chauffeur,id_camion, lot_de_bord,triangle,pelle,balai,date) …
-4
votes
1 answer
1 2 3
11
12