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

  • Home
  • SEARCH
  • 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 1056667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:44:56+00:00 2026-05-16T17:44:56+00:00

An example of my scenario is a large setup page for an application, the

  • 0

An example of my scenario is a large setup page for an application, the method I use is for example:

//query 1
$stmt = $dbh->prepare("...");
$stmt->execute();

//query 2
$stmt = $dbh->prepare("...");
$stmt->execute();

Would this be an accepted method to write more queries? I have no clue how it’s supposed to be done (or who does what, rather), I assume writing the second $stmt is the most acceptable way, as there is no need to create other variables, am I right?

I really wish to know how people do this sort of thing.. I don’t want to release ‘ugly’ code if I have to.

  • 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-16T17:44:57+00:00Added an answer on May 16, 2026 at 5:44 pm

    Yes, that is perfectly acceptable way to execute queries. No need to create new $stmt objects.

    Also, if you ever get the error Lost connection to MySQL server during query when performing multiple queries within a single page, always issue this with the query: This will tell the MySQL driver to use the buffered versions of the MySQL API.

    PDO::setAttribute("PDO::MYSQL_ATTR_USE_BUFFERED_QUERY", true);
    

    So that your query looks like:

    $db->prepare('select * from tablename', array(PDO::MYSQL_ATTR_USE_BUFFERED_QUERY => true));
    $db->execute();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Example scenario in an ASP.NET application using SQL Server membership provider : 1) a
I'm looking for example of how I would solve the scenario below: Imagine my
This is purely a conceptual and design idea related to EF4. The example/scenario is
example scenario is: from login screen - main screen - then when i clicked
I am trying to create a generic formatter/parser combination. Example scenario: I have a
Common scenario: I have a library that uses other libraries. For example, a math
Here is my scenario. For the example lets say that I need to return
Having some trouble with what should be a very simple scenario. For example purposes,
I have 1 unit test method that needs several parameters. I would like to
Here is a simple example scenario - A 'Tag' has many 'Questions'. When I

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.