I'm going to develop an Android application that performs simple MySQL operations by invoking server-sided phpPHP scripts. PHP-MySQL communication is done by MySQLi extension. Each operation that I'd like to perform is in a separate phpPHP file, and in a separate class. There's an example of update.php:
class Database
{
public $connection;
function __construct()
{
if(!isset($_SESSION)){
session_start();
}
$this->connection = new mysqli('localhost', $_SESSION['login'], $_SESSION['password'], 'Ubezpieczenia_OC');
if($this->connection->connect_error) {
doDatabaseConnectionError();
} else {
$this->connection->set_charset("utf8");
if(!isset($_SESSION['tables_white_list']) || !isset($_SESSION['columns_white_list'])){
$_SESSION['tables_white_list'] = array('klienci', 'polisy_oc', 'parametry_oc', 'modele_samochodow', 'marki_samochodow');
$_SESSION['columns_white_list'] = getTablesColumns($this->connection);
}
}
}
}