2
I am trying to make a relationship between three tables. I have the table tbl_eventos
which will be a table where you will store the event and its date. The table tbl_servicos_extra
will save extra services that can be added to the event. And finally the table tbl_servicos_extra_eventos
, this table will make the relationship between the events and the extra services (many to many).
What happens now, is that when I associate an extra service to the event, I have to pick up all the extra services that are not being used on that day of the event. I mean, I have an event date, so I have to make an appointment for a <select>
that has all the extra services that can be added but cannot be extra services that are already being used on the same day.
-tbl_eventos-
id_evento
data
-tbl_servicos_extra-
id_servico_extra
designacao
-tbl_servicos_extra_eventos-
id
id_evento
id_servico_extra
I am using mysql and php. To display the results I have the following:
<select name="id_servico_extra">
<?php
$sql = mysql_query("SELECT * FROM tbl_servicos_extra");
while($row = mysql_fetch_array($sql))
{
?>
<option value="<?php echo $row['id_servico_extra'];?>"><?php echo $row['designacao'];?></option>
<?php
}
?>
</select>
Here there is no filtering to show the extra services that are being used on the same day by another event.
That was it. Thank you very much!
– pc_oc