Ver Mensaje Individual
  #22 (permalink)  
Antiguo 02/08/2014, 13:57
nimaki25
 
Fecha de Ingreso: noviembre-2010
Mensajes: 131
Antigüedad: 13 años, 5 meses
Puntos: 1
Respuesta: parametros en consulta Insert PDO

gracias nuevamente, ejeje me puse a probar a ver si salia algo pero nada, no se porque me da que la aprte que me esta jodiendo es la de bindParam(img...), probe como me comentaste, quedando asi el codigo:
Código PHP:
 //Inserción de Datos en Base de Datos
        
function insertarAvisos(){
         echo 
'<pre>';
                
print_r($this->rutas);
                echo 
'</pre>';
           try{
                
$query  ="INSERT INTO avisos (titulo_aviso,categoria_aviso,tipo_aviso,comuna,aviso_completo,valor_producto,fecha_publicacion,nombre,telefono_celular,telefono_fijo,correo_electronico,direccion,img1,img2,img3,img4,img5)"//,img1,img2,img3,img4,img5 
                
$query .="VALUES(:titulo_aviso,:categoria_aviso,:tipo_aviso,:comuna,:aviso_completo,:valor_producto,:fecha_publicacion,:nombre,:telefono_celular,:telefono_fijo,:correo_electronico,:direccion,:img1,:img2,:img3,:img4,:img5)"//,:rutas[0],:rutas[1],:rutas[2],:rutas[3],:rutas[4]
                //Preparamos la consulta
                
$stmt$this->con->prepare($query);
                
$stmt->bindParam(':titulo_aviso',$_POST['titulo_aviso'],PDO::PARAM_STR);
                
$stmt->bindParam(':categoria_aviso'$_POST['categoria_aviso'] ,PDO::PARAM_STR);
                
$stmt->bindParam(':tipo_aviso'$_POST['tipo_aviso'] ,PDO::PARAM_STR);
                
$stmt->bindParam(':comuna'$_POST['comuna'],PDO::PARAM_STR);
                
$stmt->bindParam(':aviso_completo'$_POST['aviso_completo'],PDO::PARAM_STR);
                
$stmt->bindParam(':valor_producto'$_POST['valor_producto']);
                
//Fecha de Publicacion
                
$stmt->bindParam(':fecha_publicacion',date('Y-m-d'time()),PDO::PARAM_STR);
                
$stmt->bindParam(':nombre'$_POST['nombre'] ,PDO::PARAM_STR);
                
$stmt->bindParam(':telefono_celular'$_POST['telefono_celular']);
                
$stmt->bindParam(':telefono_fijo'$_POST['telefono_fijo']);
                
$stmt->bindParam(':correo_electronico'$_POST['correo_electronico'] ,PDO::PARAM_STR);
                
$stmt->bindParam(':direccion'$_POST['direccion'] ,PDO::PARAM_STR);

                
$stmt->bindParam(':img1'$this->rutas[0]); //, $this->rutas[0]
                
$stmt->bindParam(':img2' , $$this->rutas[1]);
                
$stmt->bindParam(':img3' ,$this->rutas[2]);
                
$stmt->bindParam(':img4' ,$this->rutas[3]);
                
$stmt->bindParam(':img5' ,$this->rutas[4]);


                
//Ejecutamos la Consulta
                
$stmt->execute();
                echo 
"Aviso Insertado con Exito en la Base de Datos";
                
                
                
                }catch(
PDOException $e){
                       echo 
$e->errorInfo;
                }
  
        }
//funcion InsertarAvisos 
me sale lo siguiente:

Notice: Undefined property: Avisos::$rutas in C:\xampp\htdocs\avisos\Inc\funciones.php on line 80


Catchable fatal error: Object of class Avisos could not be converted to string in C:\xampp\htdocs\avisos\Inc\funciones.php on line 102