I have two tables called users and vm_tables. Now I am displaying data from users as below.
$sel_query="Select * from users where account_id=".$_SESSION['admin_id'];
<td align="left"><?php echo $row["username"]; ?></td>
<td align="left"><?php echo $row["email_address"]; ?></td>
I would like to display data from vm_details also in same table.
Can anyone help me how to merge two tables data please.
One way is to fetch data from 2 tables in 2 separate arrays and merge the arrays into one using array_merge or array_combine functions
you can create single table using JOIN and get both table data together (for this you have to have foreign key with ur second table) or use 2 sql_query arrays n display in one table both are possible.
you could use join
Select * from users u
LEFT JOIN vm_details v ON v.common_field=u.common_field
where u.account_id=".$_SESSION['admin_id']
whereas common_field is identical column on both table.