PHP file to access database


#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

Please post only once. We promise to look at it the first time.

followed up on other post.