MySql and PHP - what is the relation

Dogbonesix

Active Member
Licensed User
Longtime User
Also new to B4A but sorta familiar with VB6. With VB6 I just install a ODBC driver and use a connection string of which a portion is shown below:

cnMySql.CursorDriver = rdUseOdbc
cnMySql.Connect = Main.hyperconnection
cnMySql.EstablishConnection

Where main.hyperconnection has the IP address, database name, Password and so forth.

I have successfully installed and used the MySql sample from B4V but I don't have a clue what PHP does or where it is supposed to be - I expect the server - but after that I am lost.

:sign0163:
 

Dogbonesix

Active Member
Licensed User
Longtime User
Php?

After further searching I found that PHP and Apache/WampServer are used together - apparently Apache/WampServer is the Webserver while PHP is a scripting language. Do I need both? Therefore; If I want to query something from my MySql database using Basic4Android I would:
1) Click on an object that I want information on on my tablet
2) The query is formatted (as necessary) in B4A and sent to the WEBserver
3) The WEBserver recognizes the query and forwards it to PHP
4) PHP sends the query to MySql and MySql gathers the Data and sends it to
5) PHP that gives it to the WEBserver then to B4A and my screen.

I guess, what I have been doing is directly querying MySql on my LAN and as I can query directly. While, using the WEB because with the latency and many other connections - I have to pass my request to a friend (so to speak) and wait for the response while I am doing something else. Correct?
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
The steps you pointed out are correct, regarding the "latency using the web" is the same thing, you build a query, send it to the cloud and receive a response, nothing different than using a direct ODBC connection.

There are plenty of free web servers out there, you can set up one locally on your machine, add PHP and MySQL and test it.
 
Upvote 0

Dogbonesix

Active Member
Licensed User
Longtime User
MySql Solved

Thanks for the support. I now have a WEBhost (free to develop, otherwise still very Inexpensive) that supports an Apache server, PHP and MySql. I will soon be able to run my VB app with data on the cloud. See where the hick-ups are and write "Localized" code in B4A until I can implement a full set on B4A - if I live that long.

Bill
 
Upvote 0

Caravelle

Active Member
Licensed User
Longtime User
Do not despair - there are many books on using PHP and MySQL together which are full of examples you can copy, as well as online tutorials. Just google "PHP and MySQL".

I have a website with 11,000 photographs which I wrote myself in this way and I knew nothing about PHP or MySQL when I started.

Caravelle
 
Upvote 0
Top