November 8th, 2012, 09:59 PM
PHP + AJAX - Database Connection Test
Hello everyone! I'm so excited I found these forums, I feel like I have a lot to learn here, but anyways, onwards with the question.
I'm looking to make a little CMS for myself to help me out a bit in learning, and just ease of use. I'm in the process of making an installation process, and I'm up to the database connection aspect. I want to use AJAX and PHP to get a connection to the specified $_GET variables filled in, and test to make sure we can connect to the database given. How would I go about checking if the connection was successful?
And how else could I go about doing this other then AJAX if anyone knows?
Thanks to all who help!
November 8th, 2012, 11:55 PM
The only alternative to AJAX is submitting the form to another page as you would normally do.
As far as how you would literally go about checking if the connection was successful; you would just use an if statement if you're using mysqli and an exception try/catch block if you're using PDO.
There are really three parts to something like this.