Ver Mensaje Individual
  #1 (permalink)  
Antiguo 17/09/2011, 17:48
thehack
 
Fecha de Ingreso: abril-2010
Mensajes: 151
Antigüedad: 14 años
Puntos: 1
problemas al actualizar datos con implode

hola chicos trato de actualizar datos de un archivos en mi base de datos atravez de ajax mediante $_POST los errores que me dan son este

br />
<b>Notice</b>: Undefined offset: 1 in <b>C:\xampp\htdocs\redsocial.com\app\modelos\Mensa jes.php</b> on line <b>334</b><br />
<br />
<b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in <b>C:\xampp\htdocs\redsocial.com\app\modelos\Mensa jes.php</b> on line <b>334</b><br />
<br />
<b>Notice</b>: Undefined offset: 2 in <b>C:\xampp\htdocs\redsocial.com\app\modelos\Mensa jes.php</b> on line <b>335</b><br />
<br />
<b>Warning</b>: implode() [<a href='function.implode'>function.implode</a>]: Invalid arguments passed in <b>C:\xampp\htdocs\redsocial.com\app\modelos\Mensa jes.php</b> on line <b>335</b><br />

aca el codigo

Código PHP:
function editMensajes(){
     
$nids = array();
        
//
        
$ids explode(',',$this->Util->setSecure($_POST['ids']));
        
// ARMAR IDS
        
foreach($ids as $nid){
            
$id explode(':',$nid);
            
$nids[$id[1]][] = $id[0];
        }
        if(empty(
$nids)) return false;
        
$act $this->Util->setSecure($_POST['act']);
        
        switch(
$act){
            case 
'read':
                
$this->query("UPDATE u_mensajes SET mp_read_to = 1 WHERE mp_id IN(".implode(',',$nids[1]).") AND mp_to = {$this->User->uid}");
                
$this->query("UPDATE u_mensajes SET mp_read_from = 1 WHERE mp_id IN(".implode(',',$nids[2]).") AND mp_from = {$this->User->uid}");
            break;
            case 
'unread':
                
$this->ejecutarConsulta("UPDATE u_mensajes SET mp_read_to = 0 WHERE mp_id IN(".implode(',',$nids[1]).") AND mp_to = {$this->User->uid}");
                
$this->query("UPDATE u_mensajes SET mp_read_from = 0 WHERE mp_id IN(".implode(',',$nids[2]).") AND mp_from = {$this->User->uid}");
            break;
            case 
'delete':
                
$this->query("UPDATE u_mensajes SET mp_del_to = 1 WHERE mp_id IN(".implode(',',$nids[1]).") AND mp_to = {$this->User->uid}");
                
$this->query("UPDATE u_mensajes SET mp_del_from = 1 WHERE mp_id IN(".implode(',',$nids[2]).") AND mp_from = {$this->User->uid}");
                
// BORRAMOS SOLO SI LOS DOS LO HAN DECIDIDO :D
                
$query $this->select("u_mensajes","mp_id","mp_del_to = 1 AND mp_del_from = 1 AND (mp_to = {$this->User->uid} OR mp_from = {$this->User->uid})");
                while(
$row mysql_fetch_assoc($query)){
                    if(
$this->delete("u_mensajes","mp_id = {$row['mp_id']}")){
                        
$this->delete("u_respuestas","mp_id = {$row['mp_id']}");
                    }
                }
                
$this->free($query);
                
//
            
break;
        }
    } 

Última edición por thehack; 17/09/2011 a las 17:49 Razón: edit codigo faltante