# Connect Adalo app with MySql database/table

**URL:** <https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592>\
**Category:** Database\
**Created:** [January 4, 2021, 4:10pm UTC](https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592 "2021-01-04T16:10:38Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Karstein](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@Karstein](https://forum.adalo.com/u/Karstein)\
**Post date:** [January 4, 2021, 4:10pm UTC](https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592/1 "2021-01-04T16:10:38Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [January 4, 2021, 4:31pm UTC](https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592/2 "2021-01-04T16:31:05Z")

</div>

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 - #5 by anon78309838](https://forum.adalo.com/t/mysql-data-base-vs-adalo/5570/5)

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

Best regards, Victor.

---

<div class="post-metadata">

**Author:** ![Karstein](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@Karstein](https://forum.adalo.com/u/Karstein)\
**Post date:** [January 4, 2021, 9:30pm UTC](https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592/3 "2021-01-04T21:30:41Z")

</div>

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](https://us1.discourse-cdn.com/flex020/uploads/adalo/original/2X/e/e9b3cf41258d7afc8284e5386d0d58b8602c0660.jpeg)

---

<div class="post-metadata">

**Author:** ![Victor](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.adalo.com/victor/32/2054_2.png) [@Victor](https://forum.adalo.com/u/Victor)\
**Post date:** [January 5, 2021, 11:20am UTC](https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592/4 "2021-01-05T11:20:10Z")

</div>

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: [Returning JSON from a PHP Script - Stack Overflow](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/](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

---

<div class="post-metadata">

**Author:** ![Karstein](https://avatars.discourse-cdn.com/v4/letter/k/8edcca/32.png) [@Karstein](https://forum.adalo.com/u/Karstein)\
**Post date:** [January 5, 2021, 4:01pm UTC](https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592/5 "2021-01-05T16:01:42Z")

</div>

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'); …. ?\>

---

<div class="post-metadata">

**Author:** ![manuelvicz](https://avatars.discourse-cdn.com/v4/letter/m/a698b9/32.png) [@manuelvicz](https://forum.adalo.com/u/manuelvicz)\
**Post date:** [February 23, 2021, 4:32pm UTC](https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592/6 "2021-02-23T16:32:24Z")

</div>

Any solutions fellas? Having the same issue ☹

---

<div class="post-metadata">

**Author:** ![Drearystate](https://avatars.discourse-cdn.com/v4/letter/d/ea5d25/32.png) [@Drearystate](https://forum.adalo.com/u/Drearystate)\
**Post date:** [November 14, 2021, 3:04am UTC](https://forum.adalo.com/t/connect-adalo-app-with-mysql-database-table/7592/7 "2021-11-14T03:04:22Z")

</div>

Karstein, would you be interested in proviing that script? I am trying to connect mysql database to adalo as well and I am trying to figure it out.
