FrontlineSMS

FrontlineSMS let users send, receive and manage SMS over a mobile network.

I am currently working on something that requires that can use the http trigger to send a text but get the numbers and the message from a mysql database using php. My very very simple code is:

 

<?php
    include "lib/configtxt.php";
    $query="select * from contact";
    $result=mysql_query($query);
    while($info=mysql_fetch_array($result))
    {
    $url=$info['phoneNumber'];
        print"<a href='localhost:8011/send/sms/".$url."/HiHi/'>send texts</a>";

    }
    ?>

The configtxt.php file has the information needed for php to connect to the database such as username, password, database name etc. I was hoping to activate the trigger when the admin of the website(the one I am building) clicks on the text "send texts". The text "HiHi" is just for the test to see if it can actually send it to the numbers in the database. I am however getting the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\partytime\index.php on line 183

 

If anyone can help me out with this I would appreciate it very much.

 

Thanks in advance.

Tags: http, mysql, php, trigger

Views: 1077

Reply to This

Replies to This Discussion

Hi Njuguna,

 

Thanks very much for posting. Unfortunately, the FrontlineSMS team is not able to provide support on PHP issues here, but there may hopefully be another FrontlineSMS user on the forum able to help.

 

All the Best,

Florence

Thanks Florence, Hopefully there is someone who can help.

Hi Njuguna,

can you try this enhanced line of code for the query

$result mysql_query($query) or die(mysql_error());

and see whether you get any info on the error details.

Also, you are connected to your database (called mysql_connect before), right?


Thanks a lot Mathias!! I had not used the mysql_connect query and I also removed the include file statement and just passed the database details variables on the same page thanks to the error message.

My modem is acting up so let me try it in a few hours and I will get back to you on if it works and sends the texts.

put http:// in front of localhost:8011  --> http://localhost:8011

 

And 8011 is the port you configured in FSMS, and it's running, right?

The port is ok, I had tested it. I will put the http:// before localhost, but I am thinking that the problem is with the modem because even my computer is not recognizing it sometimes. I am going to try another modem and get back to you on the result.

 

THANKS A LOT!! :) :)

Tried a different modem and it worked. Thank a lot man!!

RSS

© 2014   Created by FrontlineSMS Admin.   Powered by

Badges  |  Report an Issue  |  Terms of Service