PDA

View Full Version : How to conect to an online MYSQL database and retrieve fields



Michael Hartlef
27-05-2009, 23:35
Hi folks,

maybe someone has done it before here with thinBasic. I would like to connect to an online MYSQL database and read and write to it. Can anyone provide an example script?

Thanks
Michael

kryton9
28-05-2009, 01:38
Mike, I've done it with PHP, but if I understand correctly you wanted a thinBasic example.

Here is a short but good tutorial to give you an idea of how it is done in PHP and it might help in doing it via thinBasic then:
http://www.php-mysql-tutorial.com/wikis/mysql-tutorials/connect-to-mysql-database.aspx

John Spikowski
28-05-2009, 02:15
Hi Michael,

If you want to do it in Basic, here is a ScriptBasic example.

http://www.scriptbasic.org/forum/index.php/topic,3.0.html


John

Michael Hartlef
28-05-2009, 05:56
Yes I need to do this inside a thinBasic script.

Thanks Kent for the php example, I did this before. And thanks John for the example.

Petr Schreiber
28-05-2009, 07:49
Hi Mike,

I am not sure how to connect to online database, but I remember I learned to exam on SQL by modifyiing samples from SampleScripts/ODBC.

I guess connecting to something online is just matter of properly specifying data source in OdbcOpenConnection.

ErosOlmi
28-05-2009, 08:08
Mike,

check the following http://www.greatwebdivide.com in particular url: http://www.greatwebdivide.com/code_other.htm
It is Don Dickinson web site. He did some experiment with MySql, maybe it can help.

I think we need to develop a native thinBasic module for MySql in the future.

Eros

John Spikowski
28-05-2009, 09:05
The attached zip is the ScriptBasic MySQL extension module interface code. It might help in defining the thinBASIC MySQL module.

Here is the conversion of this code to BCX done by Mike Henning. (BCX Project Manager)

http://basic-compiler.com/forum/index.php?topic=84.0

I will try to help with any questions you might have building your own.

Michael Hartlef
28-05-2009, 16:04
Thanks guys for the resources. I'll see what I can do with them.

John Spikowski
28-05-2009, 18:38
Michael,

The ScriptBasic example I posted the link to is using the mysql::FetchHash() call which uses the associative array feature of the language. Take a look at the mysql::FetchArray() call which should work fine with thinBASIC. If your doing join's or working with multiple tables, you would need to use this anyways.

Here is a link to the docs for the extension module.

http://www.scriptbasic.org/docs/mysql/mod_mysql_toc.html

John

John Spikowski
16-06-2009, 02:08
Hi Michael,

Any progress with your thinBASIC MySQL interface?


John

Michael Hartlef
16-06-2009, 06:07
No, I followed a different approach with a new module Eros created.

But thanks for providing informations.