Connect Adalo app with MySql database/table

Hi, I would like to connect my Adalo app to use a MySql database that I already have.
Is there a demo or an example that shows how to setup at API Base URL to a MySql database/table to read, insert and delete data?

Hi @Karstein,

I don’t think this is possible without a “Wrapper” for MySQL which provides a REST-like interface to the DB.

See the post here: Mysql data base vs adalo

I’d be also interested to know if someone have implemented this.

Best regards, Victor.

Hi, I have created a php script (Web Service) that reads data from my database (MySql server)
I can see that I successfully can call this service from Adalo. I can see that data is received in the Response, but I also get this error - An error occurred when calling Get All Unsupported content type: text/html so I can’t create the collection. Any Ideas how to fix this?
php script

Hi @Karstein,

Ok, I see.
Try to return Content Type: application/json instead of text/html in your script.

This is the 1st example I found on google: https://stackoverflow.com/questions/4064444/returning-json-from-a-php-script

As I see in full response, you’re returning HTML tags (like <br>) there. That’s not correct. Adalo needs the data to be in a JSON format, you can validate it here for example: https://jsonlint.com/.
For example, JSON may look like this: {“city”:“Oslo”,“country”:“Norway”}.

Also: if you’re connecting MySQL table to have an external collection, please note, that Adalo will form the collection properties based on 1st row of the response. So you need to have all property-value pairs to be present in your 1st row.

Hope this helps.

Best,
Victor

Modified PHP script that reads from database to deliver data on JSON format. Included header Information in the PHP script “Content-type:application/json;charset=utf-8;”
Now everything works fine and can access data from MySQL database from my Adalo app😊

PS! The error related to unsupported content type: text/html error was related to a blanc space in the PHP scrip. To be able to change content-type to json in header output, the must be no spaces before < in the PHP script

<?php header('Content-type:application/json;charset=utf-8'); …. ?>
2 Likes

Any solutions fellas? Having the same issue :frowning: