I am developing a student registration system, they have a career, semester, period. These attributes are stored in the student table as an id, race_id, semester_id, period_id, and represent a data from another table, since I have selections loaded into tables. I have a list that works with this code:
function bd_alumno_datos_todos(){
$sql = "SELECT
cedu_alum, carr_id, seme_id, pera_id, peri_id, capa_id
FROM
alumno
ORDER BY cedu_alum ASC";
$datos = sql2array( $sql );
return $datos;
}
It shows all the data of the student, but it happens that it shows the aforementioned ids, where career goes 3, semester 4, period 6, and so on, I would like to know how to do so that by showing the list, each value ID is changed by its respective value in the table, ie.
carrera_id = 3, will come out systems carrera_id = 2, education
Same for the others as I could do?
here the code of the list
<?php include 'conexion.php'; $alumno= bd_alumno_datos_todos(); <h2>Listado de Alumnos</h2> <table> <thead> <tr>
<th><center>Cédula</th>
<th><center>Carrera</th>
<th><center>Semestre</th>
<th><center>Período</th>
<th><center>Capacitado</th>
<th><center>Opciones</th>
</tr>
</thead>
<tbody>
<?php foreach ($alumno as $alumno_temp): ?><tr>
<td><?=$alumno_temp['cedu_alum']?></td>
<td> <?= $alumno_temp['carr_id'];?></td>
<td><?=$alumno_temp['seme_id']?></td>
<td>
<?=$alumno_temp['pera_id']?>
<td>
A friend told me that with something like this:
function bd_carrera_datos($id){
$sql = "SELECT
carr
FROM
carrera
WHERE
carr_id = '$id'
LIMIT 1";
$datos = sql2row( $sql );
return $datos; }
that will take the value of the ID but it has not worked
try to do this in the column;
but only shows the race ID.
Thank you very much for your answers!