Recieving information from a database to Arduino

Hello.

Me and my friend are currently doing a school project where we are making a website where the user is supposed to be able to send out phone messages through. We're using an Arduino with a GSM Shield to send out the messages. However we're now on the last bit of the project where we have to connect the arduino to the database and program it to receive the phone message and thereafter send it out. The problem is that we haven't been able to find any good tutorial on how to connect an Arduino to a phpmyadmin database.

How do we connect the Arduino to the database?
Is it possible with the database being written in php code?
Could you possibly give us code example or perhaps give us any link to a tutorial on this?

A user can deposit a text message together with a destination number on a web server. Your arduino then periodically gets waiting messages from the web server and sends these to the destination number via its GSM shield. Is that right ?

If that is correct, you have to use the Arduino to contact the web server using the GSM shield (in web client mode) and say the HTTP get method to obtain the next message to be sent, then again using the GSM shield, dispatch the message. Optionally, send a confirmatory message back to the web server that the message has been successfully sent.

I am not familiar with using the GSM shield to connect to anything (except to send out a SMS text message)..

However, I have done everything else you touched on before.

IMHO.. (and this just a big problem for all projects that user this approach)..

How does the Arduino -know- when to poll the server/database to see if there is a message in 'queue' that needs to be sent?

Its sort of a waste of resources to just have the Arduino constantly polling some hosted PHP script that in-turn tells the Arduino there is or is not a message waiting to be sent..

How often does the Arduino 'check'?
Seconds? Minutes?
And when there is NOT a message waiting?

Thats a lot of overhead... and http calls..etc.. Having some sort of MQTT server with an Arduino 'subscribed' to a particular 'topic' might be the best approach here..

There is even a super simple MQTT PHP class.. that can be used to write to the database.. and trigger a 'publish' announcement to all subscribed devices.