Hello friends How we can fetch data from two tables on a same place in php? for e.g. <?php $slct=mysql_query("select * from phn") or die(mysql_error()); while($ftch=mysql_fetch_array($slct)) { ?> <?php $slct=mysql_query("select * from mv" )or die(mysql_error()); while($ftch=mysql_fetch_array($slct)) { ?> PHP: i want to show both tables data on a same place. Thanks in advance.
<?php // Make a MySQL Connection // Construct our join query $query = "SELECT family.Position, food.Meal ". "FROM family LEFT JOIN food ". "ON family.Position = food.Position"; $result = mysql_query($query) or die(mysql_error()); // Print out the contents of each row into a table while($row = mysql_fetch_array($result)){ echo $row['Position']. " - ". $row['Meal']; echo "<br />"; } ?> This is left join example. Left join fetch all the record for left table, in this case - family table and fetch matching record for right table. Vice-versa for right join