![]() ![]() ![]() MAMP (My Apache – MySQL – PHP) is a development environment that lets you manage your sites locally. Similarly, if you’re wanting to do some development and don’t want to work directly on your live site, the local development approach might be for you. db-connect.If you’re looking to either develop plugins or themes and want to set up a test environment for WordPress, it’s possible to do it locally on your PC or Mac. The script for Database connection is given below. `id` int(20) NOT NULL AUTO_INCREMENT PRIMARY KEY,įollowing are the PHP scripts that you can copy paste in the htdocs->test_android folder. CREATE TABLE IF NOT EXISTS `firstDB`.`users` ( First, let’s DROP the Table users and create a fresh one in the context of the above application. Before we jump onto the app logic let’s work on the PHP scripts and MySQL Database. To keep it short and simple we’ll be checking if the username and email are unique during registration. We’ll be developing a sign-in/register application. Now that we’ve discussed the basic setup of PHP and MySQL, let’s get into the android login application part. ![]() If it’s not connected, then try restarting the XAMPP servers. Mysql_connect() is a PHP’s inbuilt function to connect to MySQL database with the parameters listed above. Let’s create a test-connect.php script and add it in the htdocs->test-android folder. Following are the inputs and there default values for a XAMPP server To connect a PHP script to MySQL database three input values are required. If the table is successfully created, you’ll end up with a screen similar to this: Connecting PHP to MySQL Database `id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY , Run the following query in the console CREATE TABLE `firstDB`.`users` ( Let’s create a users table in the newly created Database. The newly created empty database would be visible in the left sidebar. Open the phpMyAdmin by visiting Now select the Databases Tab that’s present in the top left of the headers row. Now open the url You’ll end up with a screen like this: Setting Up MySQL Database Create a new folder here lets say test_android and copy paste the test.php that was created before. if you’re using a MAC then goto Applications->Xampp->htdocs. Note: Knowing PHP is not mandatory for this tutorial.
0 Comments
Leave a Reply. |