Good Day Everyone!
I am working on something that is new to me and that is to get data from my phpmyadmin and display it in an android application using XAMPP and JSON. I was wondering what could be the steps that must be taken to make this connection possible. For now, I have a php file that inserts data into a database stored in phpMyAdmin and it works. I am looking to display or add data from an android application. Could somebody please give me steps on how to start this or a link that will help me with this issue. Thanks. Here's my php file right now.
<?php
$server = 'localhost';
$user = 'root';
$password = '';
$database = 'testdb';
$productName = $_POST["txtProductName"];
$price = $_POST["txtPrice"];
$db = mysql_connect($server, $user, $password);
$db_select = mysql_select_db ($database, $db);
$query = "Insert into products (name, price)
Value ('$productName' , '$price')";
if (!$db) {
die('Could not connect to database');
}
enter code here
if (!mysql_select_db($database, $db))
die("Could not open products database");
if (!($result = mysql_query($query , $db)))
{
print("Could not execute query<br/>");
die(mysql_error());
}
mysql_close($db);
?>