Jump to content

rn14

Members
  • Posts

    111
  • Joined

  • Last visited

    Never

Posts posted by rn14

  1. 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.

  2. 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?

  3. $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?

  4. 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??

  5. 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>
    

  6. 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; 
    
    
    
    
    

  7. 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;

     

     

  8. 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;

  9. 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();
    }
    ?>
    

  10. 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];
    }
    }
    ?>
    

  11. 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> 
    
    
    

  12. 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> 
    
    

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.