Advertisement
Guest User

Untitled

a guest
Jan 18th, 2016
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 KB | None | 0 0
  1. <?php
  2. $dbhost = 'localhost';
  3. $dbuser = 'user';
  4. $dbpass = 'password';
  5. $conn = mysql_connect($dbhost, $dbuser, $dbpass);
  6. if(! $conn ) {
  7. die('Could not connect: ');
  8. }
  9. $request = file_get_contents('php://input');
  10. $input = json_decode($request, true);
  11. mysql_select_db('contacts1');
  12.  
  13. $count = count($input);
  14. for ($i = 0; $i < $count; $i++) {
  15. $mName = $input[$i]['SoftID'];
  16. $mNumber = $input[$i]['Function'];
  17. $mId = $input[$i]['Id'];
  18. $mTheNumber = $input[$i]['TheNumber'];
  19. $mTheName = $input[$i]['TheName'];
  20. $mTheDate = $input[$i]['TheDate'];
  21. $mTheDirection = $input[$i]['TheDirection'];
  22. $mTheText = $input[$i]['TheText'];
  23. $sql = 'INSERT INTO sms '.
  24. '(TheNumber,TheName,TheDate,TheDirection,TheText) '.
  25. 'VALUES ( "'.$mTheNumber.'" , "'.$mTheName.'" , "'.//$mTheDate.'" , "'.$mTheDirection.'" , "'. $mTheText.'")';
  26. $retval = mysql_query( $sql, $conn );
  27. if(! $retval ) {
  28. die('Could not enter data');
  29. }
  30. }
  31. echo "SMS";
  32. mysql_close($conn);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement