Hi
I want to get a output from one table (p_familie) based on information from another table (p_planter) and then print it in a selectbox on a webpage ..
My problem it that i get the same familie_ID's many times and want to limit this to only one time.
I am new to PHP and mysql... and at this point i cant see the trees in the forrest.. Is it my SQL syntax or my PHP syntax i need to change...??
My tables look like this
P_familie
- PF_ID
- PF_Name
- PF_D_Name
P_planter
- PL_ID
- PL_Fam
- PL_Kat
- PL_Name
My syntax looks like this..
$Fam_Name = mysql_query("SELECT p_familie.PF_ID,p_familie.PF_D_Name FROM p_familie,p_planter WHERE ((p_planter.PL_Kat = 13) AND (p_planter.PL_Fam = p_familie.PF_ID))")or die(mysql_error());
while ($Fam_type = mysql_fetch_array ($Fam_Name)) {
$PF_ID=$Fam_type 'PF_ID';
$PF_D_Name=$Fam_type 'PF_D_Name';
$option_fam.= "<option value='$PF_ID'> $PF_D_Name";
}
?>
<?php echo $option_fam; ?>