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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T19:34:56+00:00 2026-05-21T19:34:56+00:00

I have a site with a login form. When the login form page is

  • 0

I have a site with a login form. When the login form page is loading I create a new PDO object to see if the connection is working. If it is successful in opening a connection the viewer will see a login form. If it’s not successful they will get a message saying the server is down.

They then fill in their details and click login. The login process is via AJAX so the page will not reload and JavaScript will send their details of to a PHP file on the server.

How can I make use of the connection I established earlier?

I was thinking about using persistent connection but I don’t really understand what it does so I have know idea if it will help me. I don’t want to have to create a new connection and check if it works as we did it earlier.

So will a persistent connection work? I read the php.net documentation for it with MySQL but I didn’t understand it and couldn’t find any documentation for its usage with PDO.

  • 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-21T19:34:57+00:00Added an answer on May 21, 2026 at 7:34 pm

    Persistent connections are handled by PHP itself. You do not need to handle it other than activating it.

    If you read the following page: https://www.php.net/manual/en/pdo.connections.php, you will get information about how to activate the persistent connection.

    <?php
    $dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array(
        PDO::ATTR_PERSISTENT => true
    ));
    ?>
    

    You need to execute this line everytime you want to "connect" to the database. If the connection already exists, it will use it under the hood.

    And now, if you want to check if the connection worked, you have to use a try/catch (as explained in the link above).

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

Sidebar

Related Questions

on my web site I want to have login/registration form in modal window done
I have a problem on my site's login page in IE7 browser. One of
I have wordpress a site with a customized login page, the problem is when
I have a login form that is hidden on every page and shows itself
I have a web page containing a login form which loads via HTTP, but
Currently I have a custom form login page in Spring Security 3 that sends
I have an ajax based login form for my site and have noticed that
I have a login form on our new website design, and it has a
I'm creating a new site for my project. I have made a index.php page
I have a page in a site that contains an iframe with a form

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.