First Programer
First Programer

Reputation: 147

How to update table in prestashop1.6

I'm trying to update a table in prestashop 1.6. The table I'm trying to update is ps_employee, but when I try to do the following I get an error.

$where='email='.$this->email_customer;
$pwd=******;
$updateEmployee= Db::getInstance()->update(
    'employee', 
    array('passwd' => $pwd),
    $where
);

Unfortunately I don't have access to the error at this time. However, this code works when trying to update where id_employee=6, but when I try to use it with an email adress it fails. enter image description here

Upvotes: 2

Views: 61

Answers (1)

Ravi Hirani
Ravi Hirani

Reputation: 6539

Write this line as below to avoid syntax error:-

    $where="email='$this->email_customer'";

Note:- Always encrypt your password before saving it to DB. One of the simplest technique is MD5. eg. $password = md5($_POST['password']);

Upvotes: 1

Related Questions