Advertisement
customhost

Untitled

Jun 4th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.51 KB | None | 0 0
  1.  
  2. // your
  3. if (isset($data['invert'])) {
  4.     $id = $data['invert'];
  5.     $tmp = $this->getProduct($id);
  6.     $flag = $tmp['status'];
  7.     $flag =($flag + 1) % 2;
  8.     $this->db->query("UPDATE " . DB_PREFIX . "product SET status='" . $flag . "' WHERE product_id = '" . (int)$id . "'");
  9. }
  10.  
  11.  
  12. // new one
  13. if (isset($data['invert'])) {
  14.     $id = (int) $data['invert'];
  15.     $tmp = $this->getProduct($id);
  16.     $flag = ! (int) $tmp['status'];
  17.     $this->db->query("UPDATE " . DB_PREFIX . "product SET status = {$flag} WHERE product_id = {$id}");
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement