Two table join in php. try this code, hope it will be helpful for you. You need to careful that First table id will be match Second table id.
<?php include "dbconnect.php"; $select_data=mysqli_query($con,"SELECT * FROM `first_table` LEFT JOIN `second_table` ON first_table.id = second_table.id"); $row=mysqli_fetch_array($select_data); print_r($row); ?>
Two table join with where clause:
<?php include "dbconnect.php"; $select_data=mysqli_query($con,"SELECT * FROM `first_table` LEFT JOIN `second_table` ON second_table.id=first_table.id WHERE second_table.email_id=first_table.email_id"); $row=mysqli_fetch_array($select_data); print_r($row); ?>
Question and answer is powered by AnsPress.io