Including php into new page

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Cynthia
Forum Newbie
Posts: 1
Joined: Thu Jan 28, 2010 2:25 am

Including php into new page

Post by Cynthia »

Hiya,

I'm trying to include the output file (output.php) into a new webpage, but all the webbrowser shows is a blanc page, with any content. I don't get it...?

<?php include("output.php"); ?>

Any help would be appreciated!

here's the output.php code:

Code: Select all

<?
$username="wsb1";
$password="wsb2";
$database="wsb3";
 
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM berichten ORDER BY titel DESC";
$result=mysql_query($query);
 
$num=mysql_num_rows($result);
$ret = mysql_query($query) or die(mysql_error());
mysql_close();
 
$i=0;
while ($i < $num) {
 
$taal=mysql_result($result,$i,"taal");
$titel=mysql_result($result,$i,"titel");
$auteur=mysql_result($result,$i,"auteur");
$doc=mysql_result($result,$i,"doc");
$datum=mysql_result($result,$i,"datum");
$website=mysql_result($result,$i,"website");
$nieuwsbrief=mysql_result($result,$i,"nieuwsbrief");
$totdatum=mysql_result($result,$i,"totdatum");
$inhoud=mysql_result($result,$i,"inhoud");
 
 
echo
"<br><h2><font face=Arial color=#3366FF>$titel</font></h2>
<font face=Arial size=2 color=#999999>$inhoud</font></br>
<br><i><font face=Arial size=1 color=#222222>$auteur</font></i></br>";
 
$i++;
}
 
?>
 
<? echo $variablename; ?>
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: Including php into new page

Post by JakeJ »

It's likely that your query is not returning results so there is nothing to display. Check the results first using isset()

Code: Select all

 
Ex: If (isset($taal)) {
   Echo '$taal is set';
}
Else {
   Echo '$taal is not set';
}
And what's with that extra statement at the bottom? I assume you were just testing. $variable isn't going to return anything because there is nothing setting it. You broke out of php and back in to it so anyplace that you had $variable set is going to return null.
Post Reply