Advertisement
nicolas-chuet

modalManager

Apr 7th, 2020
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1.  
  2. <?php
  3. class ModalManager
  4. {
  5. private $mysqli;
  6.  
  7. /**
  8. * ModalManager constructor.
  9. */
  10. public function __construct()
  11. {
  12.  
  13. }
  14.  
  15. public function insertMysqli(Modal $modal)
  16. {
  17.  
  18. $mysqli = new mysqli('localhost', 'root', '', 'base_test_modal');
  19. if (mysqli_connect_errno()) {
  20. printf("Echec de la connexion: %s\n", mysqli_connect_error());
  21. exit();
  22. }
  23.  
  24. $mysqli->query("INSERT INTO `modal` (`title`, `text_modal`) VALUES ('" . $modal->getTitle() . "','" . $modal->getText() . "') ");
  25.  
  26. $modalid = $mysqli->insert_id;
  27. foreach ($modal->getUrls() as $domain) {
  28.  
  29. $mysqli->query("INSERT INTO `client` (`domain`, `id_text_modal`) VALUES ('" . $domain . "','" . $modalid . "')");
  30. }
  31.  
  32.  
  33. }
  34.  
  35.  
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement