title: Trying To Retrieve Messages With Clickatell Half Working
body: <p>This is the code I have.  Maybe I have a giant error.  However, the system will put the API ID, the Message ID, and the sender in the database under its own listing.  HOWVER,  now matter what I do I cannot get it to put the callback for the message text.  It doesn't seem to show up and I am wondering where I am going wrong in retrieving that.</p>
  
  <p>Thank you very much.
  Maurissa</p>
  
  <pre><code>&lt;?php 
  
  //database connection 
  
  $hostname_sCONN = "localhost"; 
  $database_sCONN = "XXXXXX";
  $username_sCONN = "XXXXX";
  $password_sCONN = "XXXXXX"; 
  $sCONN = mysql_pconnect($hostname_sCONN, $username_sCONN, $password_sCONN) or trigger_error(mysql_error(),E_USER_ERROR); 
  
  
  
  // Declare variables for url string 
  //http://www.mysite.com/callback.php?api_id=xxx&amp;apiMsgId=xxx&amp;cliMsgId=xxx&amp;status=xxx&amp;timestamp=xxx&amp;to=xxx&amp;from=xxx&amp;charge=xxx 
  
  
  //this will pull the query part of the url i.e. api_id=xxx&amp;apiMsgId=xxx&amp;cliMsgId=xxx&amp;status=xxx&amp;timestamp=xxx&amp;to=xxx&amp;from=xxx&amp;charge=xxx 
  $url = $_SERVER['QUERY_STRING']; 
  
  
  //retrieve contents of the url 
  $api_id = $_GET['api_id']; 
  $from = $_GET['from']; 
  $to = $_GET['to']; 
  $text = $_GET['text']; 
  $dated = $_GET['timestamp']; 
  $apiMsgId = trim($_GET['apiMsgId']); 
  $status = $_GET['status']; 
  $charge = $_GET['charge']; 
  
  
  
  
  mysql_select_db($database_sCONN, $sCONN); 
  $sql = "INSERT INTO tbl_messages (msgid, apiMsgId, sender, recipient, dated, message) VALUES ('$api_id', '$apiMsgId', '$from', '$to', '$dated', '$text')"; 
  $result = mysql_query($sql, $sCONN) or die(mysql_error()); 
  
  mysql_free_result($rsOutbox); 
  
  mysql_select_db($database_sCONN, $sCONN); 
  $sql2 = "SELECT value1 FROM fgusers3 WHERE mobile = '".$from."'"; 
  $result2 = mysql_query($sql2, $sCONN) or die(mysql_error());
  mysql_free_result($rsOutbox); 
  
  $query4 = "SELECT * FROM `$user` ORDER BY id_user DESC 
                      LIMIT 1";
  
  $result4 = mysql_query($query4);
  $row4 = mysql_fetch_array($result4);
  $balance = $row4['balance'];
  
  
  $finalbalance = $result2 + $balance;
  
  $sql3 = "INSERT INTO `$user` (`date`, `credit`, `balance`) VALUES ('$today', '$result2', '$finalbalance')"; 
  $result3 = mysql_query($sql, $sCONN) or die(mysql_error());
  
  ?&gt;
  </code></pre>