Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/12/2011, 09:55
thehack
 
Fecha de Ingreso: abril-2010
Mensajes: 151
Antigüedad: 14 años, 1 mes
Puntos: 1
error en sintaxis sql al actualizar datos

hola tengo un problema al actualizar un datos en mi db como no leidos me da error de sintaxis sql

error

Código:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND mp_from = 2' at line 1<br>error: UPDATE mensajes SET mp_read_from = 0 WHERE mp_id IN() AND mp_from = 2
Código PHP:
Ver original
  1. function editMensajes(){
  2.      $nids = array();
  3.         //
  4.         $ids = explode(',',  Security::antiSQL($_POST['ids']));
  5.         // ARMAR IDS
  6.         foreach($ids as $nid)
  7.         {
  8.             $id = explode(':',$nid);
  9.             $nids[$id[1]][] = $id[0];
  10.         }
  11.        
  12.         if(empty($nids)) return false;
  13.         $act = Security::antiSQL($_POST['act']);
  14.         // HMM SI NO LE ENTIENDES A ESTO NTP YO TAMPOCO xD PERO FUNCIONA :D
  15.         switch($act){
  16.  
  17.  case 'unread':
  18.                  $this->db->ejecutarConsulta("UPDATE mensajes SET mp_read_to = 0 WHERE mp_id IN(".implode(',',$nids[1]).") AND mp_to = {$this->User->uid}");
  19.                 $this->db->query("UPDATE mensajes SET mp_read_from = 0 WHERE mp_id IN(".implode(',',$nids[2]).") AND mp_from = {$this->User->uid}");
  20.             break;
  21.  
  22.        
  23.         }
  24.     }

Última edición por thehack; 07/12/2011 a las 09:56 Razón: error en escritura de codigo