vincrob Posted May 9, 2012 Share Posted May 9, 2012 Bonjour à tous, Je suis entrain de developper mon site, et j'ai ma page principale un module tm newsletter. J'ai un problème avec ce module qui ne veut pas inscrire les mails, lorsque le client n'est pas deja dans la base de donnée. Je vous montre l'extrait du .php : /* Subscription */ elseif ($_POST['action'] == '0') { $registerStatus = $this->isNewsletterRegistered(pSQL($_POST['email'])); if ($registerStatus > 0) return $this->error = $this->l('E-mail address already registered'); /* If the user ins't a customer */ elseif ($registerStatus == -1) { global $cookie; if (!Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.'newsletter (email, newsletter_date_add, ip_registration_newsletter, http_referer) VALUES (\''.pSQL($_POST['email']).'\', NOW(), \''.pSQL(Tools::getRemoteAddr()).'\', (SELECT c.http_referer FROM '._DB_PREFIX_.'connections c WHERE c.id_guest = '.(int)($cookie->id_guest).' ORDER BY c.date_add DESC LIMIT 1))')) return $this->error = $this->l('Error during subscription'); $this->sendVoucher(pSQL($_POST['email'])); return $this->valid = $this->l('Subscription successful'); } /* If the user is a customer */ elseif ($registerStatus == 0) { if (!Db::getInstance()->Execute('UPDATE '._DB_PREFIX_.'customer SET `newsletter` = 1, newsletter_date_add = NOW(), `ip_registration_newsletter` = \''.pSQL(Tools::getRemoteAddr()).'\' WHERE `email` = \''.pSQL($_POST['email']).'\'')) return $this->error = $this->l('Error during subscription'); $this->sendVoucher(pSQL($_POST['email'])); return $this->valid = $this->l('Subscription successful'); } Merci à tous pour vos réponse, j'aimerais simplement savoir comment je peux insérer les mails saisis dans ma base de donnée. Vincent Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now