Make fields of different tables appear in forms and queries

0

What I would like to do to help you understand better is the following:

I have a client table with the following fields:

IdCliente int not null primary key auto_increment;
Nombre varcjar;
Apellido varchar;
Direccion varchar;
Telefono varchar;

An invoice table:

IdFactura int not null primary key auto_increment;
Tipo char;
Fecha datetime;

And a customer_table table:

IdCliente
IdFactura

Then what I would like first is to have the client appear in the form, name and surname that would be taken from the customer table and then the amount of invoices that would be taken from some form of invoices. And apart from that, you can insert, update and delete these data. Thank you very much

    
asked by Santi Corso 16.10.2017 в 04:13
source

1 answer

1

If you want to show the data in a form, it would be more or less like that.

<?php
  //Supongo que ya tienes echa la conexion
  $consulta = mysql_query("SELECT idcliente, nombre , apellido FROM datos", 
  $conexion);
  //No hacemos un while, porque sunpongo que solo quieres mostra un 
  resultado.
  $registros = mysql_fetch_row($consulta)
  ?>
//Ahora en los text que tengas por ai repartidos en la pagina pones lo siguiente:
<input type="text" value="<?php echo $registros['idcliente']?>">
<input type="text" value="<?php echo $registros['nombre']?>">
<input type="text" value="<?php echo $registros['apellido']?>">
// Y así tendrías en unos input de texto los valores devueltos por tu consulta,

but! Eye Only the first record returned by the query.

the same to bring the bills only that in this case you would use the while.

    
answered by 16.10.2017 в 04:38