i have three table with same value of columns. example: say i have three table "table1", "table2", "table3" and each columns has "id", "title", "description", "category", "date", "thumbnail", "admin". now i'm trying to get all data from those three table. but there is a think, i want to check with if statement. if table1 not match with id, check table2. if table2 not match with id, check table3 and at last show the data. please check my below code, i'm trying to get data from those three table:
<?php
include('config/database.php');
$id=$_GET['single'];
$query=mysqli_query($conn,"select * from table1, table2, table3 where id='$id' ");
while($row=mysqli_fetch_array($query)){
$title=$row['title'];
$date=$row['date'];
$admin=$row['admin'];
$thumbnail=$row['thumbnail'];
$description=$row['description'];
$category=$row['category'];
}
?>
please help me to get all data from those three table with if statement it will be better to understand if you post an answer. thank you in advance.