PHP database help needed!!!


#1

Hi everybody,

I’m new at php I am strugling to get something working, my application sends a text message to a gateway and the gateway activates a service which is:

http://localhost/2way.php?sender=@@SEND@FULLSMS@@

The service takes in the first word in the text message and replies to the user with:

echo "I recieved your message : " . $_REQUEST[‘text’];

The following is my php code for 2way.php (it is very basic):

<? header ("Content-Type: text/plain"); if (isset($_REQUEST['sender'])) { if (isset($_REQUEST['text'])) { echo "Your balance is : " . $_REQUEST['text']; } else { echo "ERROR : 'text' parameter missingrn"; } } else { echo "ERROR : 'sender' parameter missing!rn"; } ?>

My problem is that I need the application to access my database (login), I need to send a text message to the gateway with a username and it sends the username to the 2way php file and the php file accesses the database and returns a balance(float) coresponding to the username, and then sends the balance to the sender!! as in " echo "Your balance is : " . $_REQUEST[‘sender’];

I would be very grateful if some one could help me with this one,
Thanks for your time,
James


#2

So what is your question? trying to 2 things at once? My question is what has to be done first - the app or the DB stuff? If it is the app - does it return anything? or do you simply send info. Can you include it in your program and handle it like a function? if it is DB stuff that is pretty easy with the right tutorials.