aspkiddy Posted June 23, 2011 Share Posted June 23, 2011 Hi, I have some difficulty with my 'select' In my select/menu, I display all the options come from a table (table_db_email) in my database In this table (tb_code_prmtn11_email) I have two field : fld_email_id fld_name_email It works here is a code <select name="email_adress_menu" id="email_adress_menu" class="valid" onchange="submit()"> <?php echo "<option selected=\"selected\" value=''>Choose your name</option>"; $req_email_adress_menu = " select DISTINCT id_email, fld_name_email, fld_adresse_email FROM $table_db_email ORDER BY fld_name_email "; $rep_email_adress_menu = mysql_query($req_email_adress_menu, $cnx) or die( mysql_error() ) ; while($show_email_adress_menu = mysql_fetch_assoc($rep_email_adress_menu)) { echo '<option value="'.$show_email_adress_menu['id_email'].'"'; //if($primes==$show_email_adress_menu['fld_name_email']){echo " selected";} //display to select an option!!!!!!!!!!!!!!!! echo '>'.$show_email_adress_menu['fld_name_email'].' - '.$show_email_adress_menu['fld_adresse_email'].'</option>'; } ?> </select> I have some other information come from another table : tb_code_prmtn11 (containing information about people) I have a few fields : id_resultat fld_name fld_email_id ( FOREIGN KEY (`fld_email_id`) REFERENCES `tb_code_prmtn11_email` (`id_email`) ON DELETE NO ACTION ON UPDATE CASCADE;) ... I want to put this menu on another Web page and this select must display all of the options as below( with) BY SELECTING THE OPTION THAT MATCHES THE INFORMATION FOUND IN THE SECOND TABLE : tb_code_prmtn11 How can I do this ? I know how I can make to my request : here is a code MySql : SELECT td.id_resultat,td.fld_email_id,email.fld_name_email FROM $table_db td INNER JOIN $table_db_email email ON td.fld_email_id = email.id_email WHERE td.id_resultat=$id This code works also but I don't know how I can include this second query in my menu ... Can you help me please :'( Quote Link to comment https://forums.phpfreaks.com/topic/240206-select-and-two-sql-query/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.