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

msqli select from table where a =1 or a =2

Looking for the correct use for the Where and In clause. If this is not correct could you let me know the right way to use it please mysqli_query=($connection,"select * from tablename where a=1 or a=2 and c=1 and d=2); I am trying to do the…
Patdundee
  • 161
  • 2
  • 10
0
votes
2 answers

PHP to mySQL - duplicating entry when finding insert ID

I'm having an issue with my PHP form submission to MySQL - it's a multi_query insert that is supposed to feed two tables. Everything was working fine, but I recently set up a foreign key relationship and something in the process of getting the…
skwidbreth
  • 7,888
  • 11
  • 58
  • 105
0
votes
1 answer

how to perform a mysqli multi query

I can't seem to figure out what is going wrong with my mysqli multi query. When I run it I get no errors on the php side but in Xcode I get a fatal error and it crashes. This is the code I am using on the php side to perform the mysqli multi…
Garret Kaye
  • 2,412
  • 4
  • 21
  • 45
0
votes
1 answer

mysql multiple queries or multiple 'or' operators

Let's say I have this table: img_id, img_author, img_path 1 | BillyDoe | img1.jpg 2 | BillyDoe | img2.jpg 3 | BillyDoe | img3.jpg I run another query that matches some specific criterias and that query returns an array many…
inrob
  • 4,969
  • 11
  • 38
  • 51
0
votes
2 answers

Mysql insert and select query together convert to mysqli

I have a MySQL query that works great but when i try to convert it to MySQLI I can not get it to work: WORKING SQL QUERY
jonathan young
  • 237
  • 2
  • 11
0
votes
2 answers

How to avoid one query's match id with another query

My first query got all related ids from Table A and another query got all necessary ids from Table B. Now I want to make 3rd query by those ids which not match above both query. Example: Query return: 1 , 5, 10, 15. Query return: 5. Query want to…
koc
  • 955
  • 8
  • 26
0
votes
1 answer

PHP MySQL, IF EXISTS update ELSE insert, Dosn't seem to work

I'm trying to get this code to update if the parameter exists, however, when I execute nothing happends (It does say done, and update products, but the update of products_description, dosn't seem to work. The code is here: $query = "UPDATE…
Mathias_
  • 323
  • 1
  • 4
  • 14
0
votes
1 answer

Fetching data from Two tables using Range

I have Two tables, Tour table and Tour Dates table. tours Table Id tour_title Here's a link of table to view tour table! tour_dates Table id tour_id price Here's a link of table to view tour_date table! Now I am using filter of price range…
Adas
  • 309
  • 1
  • 18
0
votes
2 answers

How to execute two sql queries in php?

I am trying to execute this code in a php page to store some data on my database. The thing is that I want to Insert data, but due to a foreign key constraint it is impossible. So, in my php code I want to execute two sql queries. The first one to…
0
votes
1 answer

how to use mysql stored procedure with insert into table

connect_error) { trigger_error('Database connection failed: '.$mysqli-> connect_error , E_ USER_ERROR); } $regid =…
Sylus
  • 1
  • 1
0
votes
0 answers

Display Multiple MYSQL Query in PHP

I have 3 queries. I want all 3 of them to run at one time and display the result. Here is my code: $query = mysqli_query($connect ,"SELECT w2.Avis as Avis,w2.Cde_Sap,w2.Don_Ordre,w2.Num_cde_cl,w2.PN_in ,w2.SN_in,w2.DATE2,w2.Statut_Cde,client.Zone …
Anuraag Kapoor
  • 101
  • 1
  • 8
0
votes
2 answers

phpmyadmin mysql syntax for creating a query from multiple queries with different where clauses

I'm attempting to join two queries with different where statements, on phpmyadmin mysql, The following is the code i need help with: SELECT elec.`Property ID`, elec.`Year`, elec.`Month`, elec.`Electric Consumption`, gas.`Gas…
0
votes
3 answers

mysql insert statement inside a while statement adds only 1 record

I have this code (refer below) $sql = "SELECT * FROM records"; $result = mysqli_query($this->db,$sql); while($row = mysqli_fetch_assoc($result)){ $itemid = $row['id']; $itemname = $row['itemname']; $itemdesc = $row['itemdesc']; …
Juliver Galleto
  • 8,831
  • 27
  • 86
  • 164
0
votes
0 answers

mysql_multi_query inside a foreach loop

I try to parse a xml file and store each node to a mysql db. The problem is that it store the data in the first loop and returns error in the second time. If I refresh the page it stores the rest data as well. I try to understand why does it behave…
b10n1k
  • 567
  • 5
  • 21
0
votes
2 answers

Creating two dependent Dropdown List

I want to make the third drop down populated based on selection on second drop down refer value from first and second drop down. jQuery