I need some help with my PHP code. I'm trying to fetch the data from two different tables from the mysql database so I could be able to output each content.
I want to output the contents just like this:
101 BBC One S East
http://www.example.com/bsdev/UK-BBC-1
102 BBC Two
http://www.example.com/bsdev/UK-BBC-2
103 ITV
http://www.example.com/bsdev/UK-ITV-1
Here is what the output show of the contents:
101 BBC One S East
http://www.example.com/bsdev/UK-BBC-1
http://www.example.com/bsdev/UK-BBC-2
http://www.example.com/bsdev/UK-ITV-1
102 BBC Two
http://www.example.com/bsdev/UK-BBC-1
http://www.example.com/bsdev/UK-BBC-2
http://www.example.com/bsdev/UK-ITV-1
103 ITV
http://www.example.com/bsdev/UK-BBC-1
http://www.example.com/bsdev/UK-BBC-2
http://www.example.com/bsdev/UK-ITV-1
Here is the code:
$qrytable1="SELECT id, channels, links, categories FROM channels_list";
$result1 = mysql_query($qrytable1) or die('Error:<br />' . $qry . '<br />' . mysql_error());
while ($row = mysql_fetch_array($result1))
{
echo "<p id='channels'>".$row["id"]. " " . $row["channels"]. "</p>";
$qrytable2="SELECT id, channels, streams FROM chris_channels";
$result2 = mysql_query($qrytable2) or die('Error:<br />' . $qry . '<br />' . mysql_error());
while ($row = mysql_fetch_array($result2))
{
echo "<p id='streams'>".$row["streams"]. "</p>";
}
//mysql_close();
//exit;
}
mysql_close();
exit;
Can you please show me an example how I could use to get the contents from two different tables of the database to output the contents I want without looping?