I am having mobile app connecting to Server database (MYSQL db). I know the best practice is NOT to expose database credential to mobile app level (security reasons).Best practice to let mobile app connect to PHP code on server side. this PHP api has DB credentials and serves mobile app with required data.
Issue : since all mobile app users are connecting to save server API (API connects to MYSQL database as single user), I am getting error : "Connection failed: User xxxxx has exceeded the 'max_connections_per_hour' resource (current value: 500)"
Server side PHP API is :
<?php
include 'DatabaseConfig.php';
// Create connection
$conn = new mysqli(DB_HOST, DB_USERNAME, DB_PASSWORD, DB_NAME);
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
switch ($tasknum ) {
case “get name”: // Request type 1
$sql="INSERT INTO xxx (CustomerID,xyz) VALUES ($custid,’xy’z)”;
$result = $conn->query($sql);
break;
case “get task”:
$sql="INSERT INTO yyy (CustomerID,xdd) VALUES ($custid,’zzz’)”;
$result = $conn->query($sql);
echo $sql;
break;
default:
echo “request task not handled” ;
}
any proposals? Thanks..