How could i include in the include.php file that whenever the code is set there is also another function added, which would be something like:
$query = "CREATE TABLE IF NOT EXISTS (here would be post parameter email from java file) (
id INT NOT NULL AUTO_INCREMENT,
PRIMARY KEY(id),
DATE DATETIME NOT NULL,
PAIN INT(11) UNSIGNED NOT NULL
)"
So this means when a user clicks register he would be added to the users table and also a new table would be created where the name of the table would be his email!
include.php:
<?php
require_once 'include/DB_Functions.php';
$db = new DB_Functions();
// json response array
$response = array("error" => FALSE);
if (isset($_POST['name']) && isset($_POST['email']) && isset($_POST['password'])) {
// receiving the post params
$name = $_POST['name'];
$email = $_POST['email'];
$password = $_POST['password'];
// check if user is already existed with the same email
if ($db->isUserExisted($email)) {
// user already existed
$response["error"] = TRUE;
$response["error_msg"] = "Uporabnik že obstaja " . $email;
echo json_encode($response);
} else {
// create a new user
$user = $db->storeUser($name, $email, $password);
if ($user) {
// user stored successfully
$response["error"] = FALSE;
$response["uid"] = $user["unique_id"];
$response["user"]["name"] = $user["name"];
$response["user"]["email"] = $user["email"];
$response["user"]["created_at"] = $user["created_at"];
$response["user"]["updated_at"] = $user["updated_at"];
echo json_encode($response);
} else {
// user failed to store
$response["error"] = TRUE;
$response["error_msg"] = "Neznana napaka!";
echo json_encode($response);
}
}
} else {
$response["error"] = TRUE;
$response["error_msg"] = "Manjkajo paramatri (name, email or password)!";
echo json_encode($response);
}
?>
Any help or ideas on how to implement that would be very helpfull.