Connecting to MYSQL with Thunkable X

Anyone have done this already? Connecting to MYSQL with Thunkable X.
I am trying to translate this from my old project. A new solution will do also. Thanks in advance.

1 Like

Your image says ADD THE URL TO THE PHP SCRIPT.....,
First, you do you want a PHP script?
Second, Why don’t you query the MYSQL server directly?

If you believe you need the PHP script then please post it here so I can design the required code blocks.

Hi, yes, and I was able to use it in Thunkable Classic and I use the tutorial below as my reference. MYSQL Server directly? I just can’t find any reference doing it in Thunkable X.

1 Like

I can see that the PHP script was written in 2011 and then updated in 2014.

MySQL has released, in 2015, a HTTP Plugin library that you can install in your database instance which will allow you to manage your data by something like this.

[type or paste code here](http://127.0.0.1:8080/sql/myhttp/SELECT+name_first,+name_last+FROM+names)

Making things easy and does not need a middle wear to transfer info.
See this post for more info.
You may also get the details here.

Anyhow, now, all what you need, if you want to continue to use the old method of utilizing PHP script, is that I provide you of a way to send both the SQLKey and the SQLQuery in an encoded format to pass it to the PHP script.

If this is what you are looking for then let me know to create you a demo project.

1 Like

Great info. And I would be glad also if you can create a demo using the old method.

1 Like

See this

To be able to URL encode the parameters for the PHP script, use the Web Viewer component to run this JavaScript code.

<!DOCTYPE html>
<html>
<head>
<script src="https://thunkable.github.io/webviewer-extension/thunkableWebviewerExtension.js" type="text/javascript"></script>
<script>
    ThunkableWebviewerExtension.receiveMessageWithReturnValue(function(message, callback) {
    callback(encodeURIComponent(message));
  });
</script>
</head>
<body>
</body>
</html>

Happy Thunking!