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 9127951
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:24:03+00:00 2026-06-17T07:24:03+00:00

I need to run an insert and a simultaneous update, but I’m using only

  • 0

I need to run an insert and a simultaneous update, but I’m using only insert test to catch errors.

The PDO does not report the error when I define a correct and an incorrect table, but if I run a query to select one incorrect table the error is reported.

I do not have enough knowledge to solve this problem, i really need to execute two queries together
Thank you.

$db-> setAttribute( PDO::ATTR_ERRMODE , PDO::ERRMODE_EXCEPTION );

try{
    $stmt = $db-> prepare( "INSERT INTO test ( name ) values( 'new name' );
                            INSERT INTO xast ( xame ) values( 'new name' );" );
    $stmt->execute();
}catch( PDOException $e ){
    print_r( $e );
}


try{
    $stmt = $db-> prepare( "INSERT INTO xast ( xame ) values( 'new name' );" );
    $stmt->execute();
}catch( PDOException $e ){
    print_r( $e );
}
**Column not found: 1054 Unknown column 'xame'**
  • 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-06-17T07:24:04+00:00Added an answer on June 17, 2026 at 7:24 am

    there is no point in preparing multiple queries in your case.

    First, prepared statements invented especially for tins case: prepare once, execute many. So, you can prepare this way

    INSERT INTO test (name) values(?)
    

    and then execute as many times as many inserts you have

    Next. For the INSERT query Mysql supports multiple VALUES clause in one query, like

    INSERT INTO test (name) values ('new name' ),('name'),(...)
    

    and so on.

    If you need to update after insert – no problem too.
    Just run 2 separate queries – one INSERT and one UPDATE. There will be not a single problem.

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

Sidebar

Related Questions

I need to run 2 tasks around 2 minutes apart but need to insert
I need to be able to run an Oracle query which goes to insert
I am using the .NET 2.0/3.5 framework for my application. I need to run
I have a Mysql insert query. I need to run the query everyday, at
I need to run this sql statement: INSERT INTO JSP_CONTROL (estado,hora_inicio,fecha,tipo) VALUES ('ACTUALIZANDO',to_char(sysdate, 'HH24:mi:SS'),sysdate,'uno');
Here is an easy one, but can't figure out why is not working. Need
I have a program in which I need to run multiple insert statements (dynamically
I am currently using MyBATIS in my project. I sometimes need to run an
What do I need to do is run insert the same thing into a
I need to run a variable amount of insert statements. Is it best to

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.