Insert data (FK) in a table with PHP from form and show

0

goodnight community. Again, requiring your great wisdom.

I tell you.

I have two tables in sql. One of students and another of careers. In Students I want to register something like

registration_id (PK) ... name .. and race_id (FK)

  12345              Diego               1

In PHPMyAdmin I registered some users and I made the query with InnerJoin so that it does not show me id_carrera and is nomCarrera

What I would like to know is by means of a PHP form as I do so that instead of the user entering the id_carrera enter the text of Lic.Informática which in this case corresponds to id_carrera = 1

The PHP form with the = POST method I have already worked on, I just do not know what variable to put, I have it like this:

 <td>Carrera : </td>
 <td><input type="text" name="id_carrera" id="id_carrera" 
   maxlength="100"/></td>

I pull the variable with PHP and normal record with id_carrera.

On the other hand I would also like to know how I show in a table the records with InnerJoin, I have it like this but it does not show me anything in the table (I already had some records that I inserted from PHPMyAdmin)

 $nroProductos = mysql_num_rows(mysql_query("SELECT 
 'alumnos.id_matricula', 
 'alumnos.nomAlu',
  'carreras.nomCarrera' 
   FROM alumnos, carreras 
    WHERE 'alumnos.id_matricula' = 'alumnos.id_matricula' 
    AND 'alumnos.id_carrera' = 'carreras.id_carrera'"));

THANK YOU IN ADVANCE. GREETINGS.

    
asked by Diego Olvera 29.10.2018 в 03:53
source

0 answers