Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class ModalManager
- {
- private $mysqli;
- /**
- * ModalManager constructor.
- */
- public function __construct()
- {
- }
- public function insertMysqli(Modal $modal)
- {
- $mysqli = new mysqli('localhost', 'root', '', 'base_test_modal');
- if (mysqli_connect_errno()) {
- printf("Echec de la connexion: %s\n", mysqli_connect_error());
- exit();
- }
- $mysqli->query("INSERT INTO `modal` (`title`, `text_modal`) VALUES ('" . $modal->getTitle() . "','" . $modal->getText() . "') ");
- $modalid = $mysqli->insert_id;
- foreach ($modal->getUrls() as $domain) {
- $mysqli->query("INSERT INTO `client` (`domain`, `id_text_modal`) VALUES ('" . $domain . "','" . $modalid . "')");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement