Jump to content

How to get mysql errors?


drasl

Recommended Posts

Hi guys, I am developing new module for activation mails, but I want to get mysql errors. I think i'm stuck on the query, because it won't insert anything.

 

Here is my code:

    public function hookcreateAccount($req)
    {
        global $cookie;
        $id_lang=$cookie->id_lang;
        $cookie->logout();
        $cookie->id_lang=$id_lang;
        $cookie->write();

        $link=md5(uniqid(rand(), true));

        Db::getInstance()->insert('ps_mail_verification', array(
            'id_customer' => $req['newCustomer']->id,
            'is_confirmed' => 0,
            'hash' => $link,
        ));

        $customer=new Customer($req['newCustomer']->id);
        $customer->getFields($req['newCustomer']->id);

        $logger = new FileLogger(0); //0 == debug level, logDebug() won’t work without this.
        $logger->setFilename(_PS_ROOT_DIR_."/modules/VerificacionEmail/debug.log");
        $logger->logDebug($mysqli->error);

        Mail::Send($id_lang,
                'account_activation',
                $this->l('Account activation'),
                array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email,'{link}' => $link),
                $customer->email,
                NULL,
                NULL,
                NULL,
                NULL,
                NULL,
                '/modules/VerificacionEmail/mails/');
        //Tools::redirect('/modules/VerificacionEmail/info.php');
    }

Thanks in advance,

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...