Relate tables with PHPGenerator and MySQL foreign key


I'm doing a database to keep track of orders digitally.

I have a table cliente , with three columns: IDcliente , Nombre (varchar) and Código (integer).

The second table, Registros is composed of several Columns: idregistro, Nombre, Codigo, fecha, tipo de pedido ... etc ....

I have a local XAMPP server (Apache and Mysql), and I am generating the forms with PHPGenerator ...

Up to this point I have clear how to make the relationship with a Dynamic Combox, which allows me, in the form, to select the name of the client and thus avoid having to write it. That using the Idcliente as Index ...

The problem is that I want to have the code also available, so I can search by name or code.

What I could not do is that, with the selected name, the corresponding client code is selected at the same time and inserted or displayed in the Code column of the Registration table.

If I add a second level to the Dynamic Combox, what happens is that it allows you to select the Name, but also the code, which, being unique, should be defined taking into account the selection. I tried to make a composite index, but it gives error for being different types of variables (Name: Varchar and Code: integer)

I hope someone can help me.


asked by Cyberfat 26.11.2018 в 11:17

0 answers