rn14
-
Posts
111 -
Joined
-
Last visited
Never
Posts posted by rn14
-
-
Im selling tickets and I need to be able to reduce the total number of tickets when one is sold. I have a table with the total number of tickets stored in a field and and a field with the quantity sold in a particular purchase. I think this is a fairly simple update query can anybody help get me started?
-
$sql="SELECT `email`, `first` FROM `test`" or die("Could not get the email addresses."); if ($query=mysql_query($sql)) { while ($req=mysql_fetch_array($query)) { mail($req['email'], $subject, $message, "Dear {$req['first']},"); } }
This is the code iv been using so far and it doesnt seem to be sending it to all the names in the database am i missing something. can php send to large numbers of records?
-
Im attempting to email a letter to around 300 email address's stored in a database. However among the field that stores the email address's are some blank fields. I have created a loop to send an individual email to each address. When I send the email to a test database it works(this would indicate that my code is fine) but this is only for around 10 address's. However when I send it this large number of email address's it only sent to around 10 of the address's. Is it possible to send an email to this many people in this way??
-
That worked a treat!
Thanks boy!
-
Iv included the entire script probarly too much code. It will send a message but only too one number in the database not all the numbers in the database. I have included the form at the bottom where the person enters the message. Also in this you will see a text box where a number can be entered. This was because this script was initially meant to send to just an individual number.
<cfoutput> <cfhttp url="http://api.clickatell.com/http/sendmsg" method="POST" resolveurl="false"> <cfhttpparam type="FORMFIELD" name="api_id" value="xxxxxxx"> <cfhttpparam type="FORMFIELD" name="user" value="xxxxxxx"> <cfhttpparam type="FORMFIELD" name="password" value="xxxxxxxxx"> <cfhttpparam type="FORMFIELD" name="text" value="<?$_POST['text'];?>"> <cfhttpparam type="FORMFIELD" name="to" value=""> </cfhttp> </cfoutput> PHP <? //dbconnection here $query = "SELECT mobile FROM customer"; $result = mysql_query($query) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { // These are the details for my clickatell account. the $to variable needs to be passed the phone numbers from database $user = "xxxx"; $password = "xxxxx"; $api_id = "xxxxx"; $baseurl ="http://api.clickatell.com"; $text = $_POST['text']; $to = $row['mobile']; } // auth call $url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id"; // do auth call $ret = file($url); // split our response. return string is on first line of the data returned $sess = split(":",$ret[0]); if ($sess[0] == "OK") { $sess_id = trim($sess[1]); // remove any whitespace $url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text"; // do sendmsg call $ret = file($url); $send = split(":",$ret[0]); if ($send[0] == "ID") echo "success<br>message ID: ". $send[1]; else echo "send message failed"; } else { echo "Authentication failure: ". $ret[0]; exit(); } ?>
<form action="page2.php" method="post"> To:<input type="Text" name="to"><br><br> Message:<input type="text" name="text"> <br><br><input type="submit" value="send"> </form>
-
This still only sends it too one number. Driving me mad! Any other suggestions? Thanks anyway
-
Im sorry about that but just really need to get this working. Any chance you could help me put this into the for loop?
-
I need to loop through a database, take the phone number value, send an individual message to each number. This is my attempt. It only takes one number from the database insteading of looping through and sending a message to all the numbers.
$query = "SELECT `mobile` FROM `customer`"; $result = mysql_query($query) or die(mysql_error()); $number = array(); while(list($mobile) = mysql_fetch_row($result)) { $number[] = $mobile; } // Test it foreach($number as $mobile) { echo $mobile . " "; } // These are the details for my clickatell account. the $to variable needs to be passed the phone numbers from database $user = "xxxx"; $password = ""; $api_id = ""; $baseurl ="http://api.clickatell.com"; $text = $_POST['text']; $to = $mobile;
-
Im trying to pass the values returned to the variable $to so that a message is sent to each number individualy but it only sends it to one number not them all
$query = "SELECT `mobile` FROM `customer`";
$result = mysql_query($query) or die(mysql_error());
$number = array();
while(list($mobile) = mysql_fetch_row($result)) { $number[] = $mobile; }
// Test it
foreach($number as $mobile) { echo $mobile . "
"; }
$user = "xxxx";
$password = "";
$api_id = "";
$baseurl ="http://api.clickatell.com";
$text = $_POST['text'];
$to = $mobile;
-
It prints out the values. I think im overlaying the previously stored value in the $to variable each time through the loop?
-
Im trying to pass the values returned to the variable $to so that a message is sent to each number individualy but it only sends it to one number not them all
$query = "SELECT `mobile` FROM `customer`";
$result = mysql_query($query) or die(mysql_error());
$number = array();
while(list($mobile) = mysql_fetch_row($result)) { $number[] = $mobile; }
// Test it
foreach($number as $mobile) { echo $mobile . "<br>"; }
$user = "xxxx";
$password = "";
$api_id = "";
$baseurl ="http://api.clickatell.com";
$text = $_POST['text'];
$to = $mobile;
-
When I use the code below (sorry I have included more of it this time) I get an error saying send message failed. Any ideas? new to programming as u might have guessed.
$query = "SELECT `mobile` FROM `customer`"; $result = mysql_query($query) or die(mysql_error()); $to = array(); while(list($mobile) = mysql_fetch_row($result)) { $to[] = $mobile; } // Test it foreach($to as $mobile) { echo $mobile . "<br>"; } $user = "xxxx"; $password = "xxxx"; $api_id = "xxxx"; $baseurl ="http://api.clickatell.com"; $text = $_POST['text']; $to = array(); // auth call $url = "$baseurl/http/auth?user=$user&password=$password&api_id=$api_id"; // do auth call $ret = file($url); // split our response. return string is on first line of the data returned $sess = split(":",$ret[0]); if ($sess[0] == "OK") { $sess_id = trim($sess[1]); // remove any whitespace $url = "$baseurl/http/sendmsg?session_id=$sess_id&to=$to&text=$text"; // do sendmsg call $ret = file($url); $send = split(":",$ret[0]); if ($send[0] == "ID") echo "success<br>message ID: ". $send[1]; else echo "send message failed"; } else { echo "Authentication failure: ". $ret[0]; exit(); } ?>
-
The code below is supposed to loop through the mobile field in a database and the send the value of this to the variable $to. This value is then used to send a text message through clickatell. However it only sends it to one of the numbers in the database not all of them. Im fairly certain my code is correct not sure weather this has something to do with clickatell??
$query="SELECT `mobile` FROM `customer`"; $result= mysql_query($query); $num=mysql_num_rows($result); if ($result) { while ($array= mysql_fetch_assoc($result)) { // Your mobile number $to = $array[mobile]; } } ?>
-
I got this working thanks very much for your help
-
I get an unexpected string error when I run this last bit?
-
or i could modify either of those suggestions(doesnt matter which) so it can do this?
-
I need to modify the first piece of code so that each email can be personalised with a name coming from another column in this table??
-
That code seems to work magic!(Thanks) would it be possible to individualise each of these emails with names stored in another column in the database?
-
My problem is that I have email addresss stored in a mysql database table. I need to loop through these values so that each address is sent as an individual email. Any suggestions please??
-
When I try this it just reloads that page. That is the hidden form.
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but21.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
This is where its submitted.
Thanks
-
for some reason that doesnt seem to work. where will i place the script tags? Sorry begginner here
-
Im attempting to disable the text field amount. The value is passed from a form on a previous page. I need to the field to be disabled when the form is opened.
Any suggestions??
<html> <head> <script type="text/javascript"> function disableField() { document.getElementById("amount").disabled=true } </script> </head> <body><form> <input type="text" id="amount" value="<?echo $amount;?>" /> value="Disable text field" /> </form></body> </html>
-
When I run it I want to send it to the paypal terminal. I need the value to be passed before this. Is it possible?
-
Just is a javascript related question but its very quite on that forum so said id see if anybody would give me a hand here!
This is the problem.
I need to pass the value of the input box amount from the first form below to the paypal form. I have been given javascript code to do this but not sure where to include this or if its enough. This small piece of javascript is below the two forms.
<form name="form1" method="post" action=""> <tr> <td>€ <input type="text" name="amount"></td> </tr>
<form name="form" action="https://www.paypal.com/cgi-bin/webscr" method="post"> <input type="hidden" name="amount" value="">
<SCRIPT language="JavaScript"> document.form.amount.value = document.form1.amount.value; </SCRIPT>
Question
in PHP Coding Help
Posted
I need to print the results from a table in a database to a web page. They could be printed in a table style format on the web. This table needs to be updated as new records are inserted in the database. Is this difficult? Anyone wanna help me get started? I have data populating the database from a form.