Reputation: 65
I added a loop that uses link (row from table) to display all links in iframes like this :
require('connect.php');
$result = mysql_query("SELECT * FROM iframe ORDER BY date DESC");
if(mysql_num_rows($result) == 0)
{
echo '<b>Message if database is empty...</b>';
}
else
{
while($row = mysql_fetch_array($result))
{
echo '<iframe width="640" height="360" src="//www.website.com/'.$row['link']. '"></iframe>';
}
}
Now I added categories, so when you upload link you select 1 of 3 options because of 3 different websites (with id 1,2,3). I want for all links with id=1 to have something like this:
echo '<iframe width="640" height="360" src="//www.website.com/blabla/'.$row['link']. '" (//link that has id=1)></iframe>';
I would like that also for other two id's, I want all websites to be displayed, but I because of different urls I don't know how to do that...
Upvotes: 0
Views: 127
Reputation: 157
You can do that simply by comparing the id. Example:
if ($row['id'] == 1) {
echo '<iframe width="640" height="360" src="//www.website.com/blabla/'.$row['link'].'"></iframe>';
}
Upvotes: 1