How to connect app to an online mysql database


#1

Please can someone give me Information about how I can connect my app to a online server mysql database without compromising with Security ?


#2

https://puravidaapps.com/mysql.php


#3

I try that method but It is giving a very long File with response code 200
don’t know the reason


#4

try the example app and php scripts from there https://puravidaapps.com/mysql.php
that solution does not return a file, but some text …
and in case you get issues, you might want to provide some more details…

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.


#5

Sir I wanna ask that is this method safe?


#6

read chapter “PHP Script” here https://puravidaapps.com/mysql.php

… as the example is designed, this update still will not prevent from SQL Injection attacks, because all queries coming from App Inventor will be executed. You will have to use prepared statements or stored procedures to be on the safe side. See also: SQL Injection Prevention Sheet or do a Google Search do find more about SQL Injections. Also it is recommended to do at least some data validation on the App Inventor side.

first get it running as it is, then adjust it to your needs
Taifun


#7

Ok I understand thanq sir


#8

Hi @Taifun sir
I am using your method of connecting to online MySQL database but getting a major error that whenever I want to fetch a multi-line statement (that contains \n) it gives only the statement before \n and leave all others, it even leaves all the values after that text column
What is the problem please help me


#9

as the php script is set up currently, commas and \n are reserved, do not use them in your columns
commas are uses as column delimiter, \n is used as row delimiter
you might want to adjust the php script to your needs

Taifun