Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
insert in multiple column with different id

This is what my database table looks like:

 id  | role    | adviser    
 1   | section |  
 2   | teacher |  

I want to insert a new section and update the existing teacher with the adviser column. Is this possible?

over 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

with pdo,while you have connected successfully

require_once 'includes/db_connect.php';

And as you have get the values with select and assigned them to variables $sectionfromadviser and $teacherfromadviser you can procedure like this

try{

                //update the verify column from users
    $sql="UPDATE tablename SET section=:section,teacher=:teacher WHERE id = :id";


    $stmt= $db->prepare($sql);
    $stmt->bindParam(':section', $sectionfromadviser);       
    $stmt->bindParam(':teacher', $teacherfromadviser);    
    $stmt->bindParam(':id', $id);
    $stmt->execute();


}catch(PDOException $e){

   if(!$stmt->execute()){

     throw $e;
   }

}catch (Exception $e) {

  throw $e;
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda