Skip to main content
1 de 2
anonfidusa
  • 267
  • 1
  • 4
  • 13

¿Cómo puedo actualizar datos en tablas relacionadas?

Tabla students

---------------------------------------------
- student_id - student_name - student_image -
---------------------------------------------
-          1 - Ana          - avatar.jpg    -
-          2 - David        - avatar.jpg    -
-          3 - Jasmine      - avatar.jpg    -
---------------------------------------------

Tabla Courses

-------------------------------------------
- course_id - course_title - course_image -
-------------------------------------------
-         7 - Photoshop    - image.jpg    -
-         8 - Cinema 4D    - image.jpg    -
-         9 - Idesign      - image.jpg    -
-        10 - Illustrator  - image.jpg    -
-------------------------------------------

Tabla students_courses

--------------------------
- course_id - student_id - 
--------------------------
-         7 - 1   
-         8 - 2   
-         7 - 3     
-         9 - 2
-         9 - 3
-         8 - 1 
--------------------------

Formulario:

<form enctype="multipart/form-data" method="post">
<input type="text" class="form-control" name="student_name" placeholder="Name Student" Value="David" required><br/>
<select class="form-control" name="course_id[]" multiple required>
<option value="1" selected>Photoshop</option>
<option value="2">DreamWeaver</option>
<option value="3" selected>Idesign</option>
<option value="4">Illustrator</option>
</select><br/> <button type="submit">Submit</button> </form>

Cual seria la sentencia para hacer el update?

La url en mi caso seria 127.0.0.1/php/update.php?edit_id=2

anonfidusa
  • 267
  • 1
  • 4
  • 13