Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6148325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T19:15:41+00:00 2026-05-23T19:15:41+00:00

How do I separate statements in a single MYSQL query? Is it a semicolon?

  • 0

How do I separate statements in a single MYSQL query?

Is it a semicolon?

I don’t think it matters but I am writing the statements to be invoked by PHP functions

Edit: the problem is that I didn’t seem to understand the UPDATE syntax, that you can execute multiple fields with one UPDATE statement

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T19:15:42+00:00Added an answer on May 23, 2026 at 7:15 pm

    Using the mysqli_ functions (docs), you can pass multiple queries in the same string using mysqli_multi_query (docs)

    Example from the docs:

    /* check connection */
    if (mysqli_connect_errno()) {
        printf("Connect failed: %s\n", mysqli_connect_error());
        exit();
    }
    
    $query  = "SELECT CURRENT_USER();";
    $query .= 'UPDATE City SET name = "Boston" WHERE id = 5';
    
    /* execute multi query */
    if ($mysqli->multi_query($query)) {
        do {
            /* store first result set */
            if ($result = $mysqli->store_result()) {
                while ($row = $result->fetch_row()) {
                    printf("%s\n", $row[0]);
                }
                $result->free();
            }
            /* print divider */
            if ($mysqli->more_results()) {
                printf("-----------------\n");
            }
        } while ($mysqli->next_result());
    }
    
    /* close connection */
    $mysqli->close();
    ?>
    

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a nasty query which joins three different queries. I don't think there's
Currently we use separate a drop statements for each stored procedure in the script
edit: SQL Server 2005 I have a customer application running on 5 separate servers.
I'm creating a PHP file that does 2 mysql database calls and the rest
I have a single procedure that has two insert statements in it for two
I used to use the standard mysql_connect(), mysql_query(), etc statements for doing MySQL stuff
I have an IF statement that consists of two separate function calls passing values
Yahoo has separate map for India ( which has more details than the regular
I am trying to separate some asp logic out into a separate page. For
I'm struggling to separate the dependencies in the following code: public static SiteConnector ConnectToSite(String

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.