954,152 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

pointing an iframe to a .php file

Is there something special i need to do to get this to work? I made a script that builds a neat little table with pictures from the sql database, and want it to go into an iframe. When i run the code I get this:

(screenshot)
http://www.freewebs.com/xylude/helpme.jpg

It just shows the actual script in text form inside of the iframe.

Here is the tag I used to link to the php doc.

<iframe src="../thumbloader.php" name="thumbnails" align="middle" scrolling="auto">
xylude
Junior Poster
123 posts since May 2008
Reputation Points: 13
Solved Threads: 11
 

post your code on from thumbloader.php

R0bb0b
Posting Shark
998 posts since Jun 2008
Reputation Points: 358
Solved Threads: 89
 

This script works fine on its own just not in the iframe...

<?

$dbhost = 'localhost';
$dbusername = 'xylude';
$dbpassword = '';
$database_name = 'allprodata';


$connection = mysql_pconnect("$dbhost", "$dbusername", "$dbpassword")
	or die ("Could not connect to database");
	
$db = mysql_select_db("$database_name", $connection)
	or die ("Could not find database");
	



	
	$returnstrings = mysql_query("SELECT * FROM videos WHERE category = 'dice'") 	
		or die(mysql_error());
		

		$rowcount = 0;
		
		
		echo "  <table width='200' border='1'>";
				while ($result = mysql_fetch_assoc($returnstrings))
{
			$rowcount = $rowcount + 1;
			
			
			$thumbnail = $result ['vidthumbsrc'];
			$hlink = $result ['previewurl'];
			echo "<td align = 'center'><img src = '$thumbnail'>";
			echo "<a href = '$hlink'>";
			echo $result ['name'];
			echo "</a></td>";
			if ($rowcount == 4)
			{
			echo "</tr>";
			echo "<tr>";
			$rowcount = 0;
			}
}

	echo mysql_num_rows($returnstrings);

?>
xylude
Junior Poster
123 posts since May 2008
Reputation Points: 13
Solved Threads: 11
 

That's strange because its just an http request as far as the server goes. It should just serve the html like normal. This doesn't make any sense to me, maybe someone else can give you more input.

R0bb0b
Posting Shark
998 posts since Jun 2008
Reputation Points: 358
Solved Threads: 89
 

Can anyone else take a look at this for me?

xylude
Junior Poster
123 posts since May 2008
Reputation Points: 13
Solved Threads: 11
 

I can't replicate your problem. It parses as normal html on my machine. Try to put a simple script like <?php echo "Hello world"; ?> in as an iframe and see if that parses.

buddylee17
Practically a Master Poster
697 posts since Nov 2007
Reputation Points: 232
Solved Threads: 137
 

Im sorry for wasting your time guys. I figured out the problem. I was trying to run the html off of a dreamweaver site file that had no PHP testing server specified, lol. Thanks for your help though :)

xylude
Junior Poster
123 posts since May 2008
Reputation Points: 13
Solved Threads: 11
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You