how to retrieve the data from two table in mysql database with if condition in php mysql -


table design

my code

<html> <head> <body> <div style="width:400px;height:300px;border:1px solid blue;">  <div style="width:400px;height:50px; float: left;">&nbsp;</div> <form> <div align="right" style="width:150px;height:30px; float: left;">show name :&nbsp;    </div> <div style="width:250px;height:30px; float: left;"> <select name="show_name" onchange="showuser(this.value)"> <option selected="selected"> -- select show --</option> <?php    session_start(); include_once('db.php'); $sql = mysql_query("select show_id, show_name show_name"); while($row=mysql_fetch_array($sql)) { $show_id = $row['show_id']; $show_name= $row['show_name']; echo "<option value ='.$show_id'>$show_name</option>"; } ?> </select> </div> <div align="right" style="width:150px;height:30px; float: left;">show place :&nbsp;      </div> <div style="width:250px;height:30px; float: left;"> <select name="show_place" onchange="showuser(this.value)"> <option selected="selected"> -- select show place --</option> <?php    $sql = mysql_query("select * show_name, show_place    show_name.show_id=show_place.show_id"); while($row=mysql_fetch_array($sql)) { $show_id = $row['show_id']; $show_place = $row['show_place']; echo "<option value ='.$show_id'>$show_place</option>"; } ?> </select> </div> </form> </div> </body> </head> </html> 

i want option box condition stud show select particular place .. please guide me how merge 2 table using if condition or foreach condition

for strict matches:

    select *      show_name     join show_place on (show_name.show_id = show_place.show_id) 

or if want names without places too:

    select *      show_name     left join show_place on (show_name.show_id = show_place.show_id) 

Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -