FrontlineSMS allows you to text message with large groups of people anywhere there is a mobile signal.
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.
Permalink Reply by Florence Scialom on May 9, 2011 at 11:05am 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
Permalink Reply by Njuguna Ndung'u on May 9, 2011 at 12:03pm 
Permalink Reply by Mathias Lin on May 10, 2011 at 2:10am 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?
Permalink Reply by Njuguna Ndung'u on May 10, 2011 at 4:20am 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.

Permalink Reply by Mathias Lin on May 10, 2011 at 4:25am put http:// in front of localhost:8011 --> http://localhost:8011
And 8011 is the port you configured in FSMS, and it's running, right?
Permalink Reply by Njuguna Ndung'u on May 10, 2011 at 4:31am 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!! :) :)
Permalink Reply by Njuguna Ndung'u on May 11, 2011 at 5:35am
© 2013 Created by kiwanja.net.
Powered by