Guest User

Untitled

a guest
Sep 2nd, 2018
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.33 KB | None | 0 0
  1. Get Users Comment From Mysql using Php
  2. <?php
  3. // Insert Comments into Database that user provides
  4. $comm = mysql_real_escape_string($_POST['addComment']);
  5. $pID4 = filter_input(INPUT_GET, 'pID', FILTER_SANITIZE_NUMBER_INT);
  6. $cID = mysql_real_escape_string($_POST['courseInfoDD']);
  7. $username = "###";
  8. $password = "####";
  9. $pdo4 = new PDO('mysql:host=localhost;dbname=###', $username, $password);
  10. $pdo4->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );
  11. $sth3 = $pdo3->prepare('
  12. INSERT INTO Comment (info, pID, cID)
  13. VALUES(:info, :pID, :cID)
  14. ');
  15. $sth3->execute(array(
  16. ':info' => $comm, ':pID' => $pID3, ':cID' => $cID
  17. ));
  18. ?>
  19.  
  20. <input type='text' id='addComment' name='addComment' tabindex='3' value='Enter comment' />
  21.  
  22. $sth3 = $pdo3->prepare('
  23. INSERT INTO Comment (info, pID, cID)
  24. VALUES($comm, $pID3, $cID)
  25. ');
  26.  
  27. $sth3 = $pdo3->prepare('
  28. INSERT INTO Comment (info, pID, cID)
  29. VALUES(:comm, :pID3, :cID)
  30. ');
  31.  
  32. $sth3 = $pdo3->prepare('
  33. INSERT INTO Comment (info, pID, cID)
  34. VALUES(:info, :pID, :cID)
  35. ');
  36. $sth3->execute(array(
  37. ':info' => $comm, ':pID' => $pID3, ':cID' => $cID
  38. ));
  39.  
  40. $sth3 = $pdo3->prepare("
  41. INSERT INTO Comment (info, pID, cID)
  42. VALUES('$comm', '$pID3', '$cID')
  43. ");
Add Comment
Please, Sign In to add comment