Hey guys,
I need some help with selecting 2 Tables from a MySQL database. Can anyone help.
Currently I am using this, and I want it to be able to select from another table called Admin and Display the Admins under admins in my table.
<?php
$host=""; // Host name
$username=""; // Mysql username
$password=""; // Mysql password
$db_name=""; // Database name
$tbl_name=""; // Table name
// Connect to server and select database.
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
// select record from mysql
$sql="SELECT * FROM $tbl_name";
$result=mysql_query($sql);
?>
<table width="400px" border="2" cellspacing="3" cellpadding="5">
<tr>
<td><table width="400px" border="0" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td col="2"
</tr>
<tr>
<td align="left" bgcolor="#FFFFFF"><strong>Normal Users</strong></td>
<td align="left" bgcolor="#FFFFFF"><strong>Admin Users</strong></td>
</tr>
<?php
while($rows=mysql_fetch_array($result)){
?>
<tr>
<td bgcolor="#FFFFFF"><? echo $rows['Username']; ?></td>
<td bgcolor="#FFFFFF"><? echo $rows['Username']; ?></td>
</tr>
<?
// close while loop
}
// close connection;
mysql_close();
?>
</table>
Can someone Please help. Thanks in advance :)