Deploy Single Page Website & Setup Cloud DB enabling PHP and Python Script

Job ID: 34071729

Budget: $30 – $250 AUD

Project Details
We have a web app that accepts travel destinations (current location and destination) and uses AJAX to post the SQL Script to local DB. We then have a script written in python running on the local machine that retrieves the request and searches via the browser UI. Once it locates the required data it posts it back to a SQL database and this inturn via AJAX on the browser pulls the results back and displays

Process Flow:
1. User enters travel destinations (current location and destination) via web browser
— backend —
1. Ajax posts the request via a php file to SQL local DB
2. A Python script polls the SQL local DB and retrieves the query data
3. A Python script via a seperate process retrieves data from another app and posts back via SQL Update into SQL Local DB
— front end
1. User in the web browser has Ajax polling SQL local DB and when data is found in DB displays back to user

Requirements
1. We want to setup a cloud SQL database removing the need for a local SQL instance (Preference is for a low cost provide / free tier to start with. Will accept your recommendation)
2. We want 1 DB and 1 table to be setup in the cloud instance
3. We want to have 4 python files updated to point to the cloud DB (currently is local DB)
- contains a select query
- contains an update query
4. We want 4 php files updated to point to the cloud DB (currently is local DB)
5. The python file runs on a local Mac laptop using Intellij IDEA CE and will need any modules enabled to let python run locally
6. We want to deploy the website onto a platform like godaddy (if Go Daddy enables cloud My SQL DB) where local Python scripts can connect
7. We want the AJAX script to work on the Godaddy website

Acceptance Criteria
1. Website enables request to be submitted via Ajax
2. Website receives response via Ajax back to screen (can update DB to show this working)
3. Chosen Cloud SQL platform can be accessed manually (for manual updates / data correction)
4. 4 Python script can call Cloud SQL DB via Mac local laptop
5. 4 Php scripts can call Cloud SQL DB via website/locally in DEV environment

Attached Example Scripts
Example Python update query:

cur = connection.cursor()
sql = "UPDATE trackingdata SET price = '{}', status = 'Complete' WHERE sessionID = '{}' AND vendor = '{}'".format(priceRead, sessionID, vendor)
cur.execute(sql)
connection.commit()

Example Python Select Query

cur = connection.cursor()
sql = "SELECT * FROM trackingdata WHERE status = 'Ready' AND vendor = 'didi' ORDER BY timestamp ASC LIMIT 1";
cur.execute(sql)
myresult = cur.fetchall()

Example PHP Select Query

$sessionID = $_GET["sessionID"];
$vendor = "didi";

$result = mysqli_query($con,"SELECT * FROM trackingdata WHERE vendor = '" . $vendor . "' AND sessionID = '" . $sessionID . "' AND status = 'Complete'");
while($row = mysqli_fetch_array($result)) {

$price = $row['price'];

}

Example Insert Query

$sql = "INSERT INTO trackingdata ". "(userID, sessionID, pickup, destination, vendor, timestamp, status) ". "VALUES('$userID','$sessionID','$pickup','$destination','didi','$timestamp', '$status')";

if (mysqli_query($con, $sql)) {
echo "Didi record inserted successfully";
echo "<br>";

} else{
echo "issue inserting Didi request";
echo "<br>";

}
Related categories: PHP Python AJAX MySQL