Hi everyone,
Ok, what I want to do is display a url that's stored in my database within an iframe when the specific record is selected.
The code I had to display the record correctly is:
<?php
$conn = mysql_connect(HOST,USER,PASS);
$db = mysql_select_db("***") or die( "Unable to select database");
if(isset($_GET["id"]))
{
$gethotel= mysql_query ("SELECT * FROM "***" WHERE id='$_GET[id]'") or die(mysql_error());
$count = mysql_num_rows($gethotel);
if($count == 1)
{
$row = mysql_fetch_assoc($gethotel);
{
$hotel= $row['link_text'];
$address = $row['address'];
$telephone= $row['telephone'];
$url= $row['telephone'];
echo "<strong> $hotel </strong><br /> $address <br /> Telephone: $telephone <br />";
}
}
elseif($count==0)
{
echo "There is no hotel with that name found!";
}
}
else
{
echo "There is no hotel found!";
}
?>
And then I was trying to pull the result from the "url" field in the database and display it using the following:
<?php
$conn = mysql_connect(HOST,USER,PASS);
$db = mysql_select_db("****") or die( "Unable to select database");
if(isset($_GET["id"]))
{
$gethotel= mysql_query ("SELECT * FROM "****" WHERE id='$_GET[id]'") or die(mysql_error());
$count = mysql_num_rows($gethotel);
if($count == 1)
{
$row = mysql_fetch_assoc($gethotel);
{
$url= $row['url'];
{
echo "<iframe src=$url style="background: #fff;" frameborder="0" height="450" scrolling="auto" width="100%"></iframe>";
}
?>
Although that doesn't work - does anyone know where I'm going wrong?
thanks :)