Display all data from two tables with MySQL query
| From: | Fates | Date: | Sat, 08 Jul 2000 00:03:49 +0000 |
| Subject: | Display all data from two tables with MySQL query | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-5491@lists.php.net to get a copy of this message | ||
I want to output all data from two different tables in the same database but it doesn't seem to
be working:
Is there something special I have to do? I am able to get the output from one database but not
both.
databaser name is musicdb
tables are: albums, songs
$query = "SELECT * FROM albums songs ORDER by Artist";
$result = mysql_db_query("musicdb", $query);
if ($result) {
echo "Found these entries in the database:<ul>";
while ($r = mysql_fetch_array($result)) {
$AlbumID = $r["AlbumID"];
$Album = $r["Album"];
$Artist = $r["Artist"];
<TR><TD> <? echo "$AlbumID"; ?></TD>
<TD> <? echo "$Album"; ?></TD>
<TD> <? echo "$Artist"; ?></TD>
<TD> <? echo "$Genre"; ?></TD>