"include() "function in windows !
| From: | Anurag Bhalla | Date: | Fri, 30 Jun 2000 02:27:22 +0000 |
| Subject: | "include() "function in windows ! | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-3941@lists.php.net to get a copy of this message | ||
Hi
Is it that the include() and require() function does'nt work in windows env.
If it is'nt then pls. tell me where am I wrong ? All the three files - main.php3,header.inc and
footer.inc are in the same directory. I have set the server to parse .inc files as php3 file. The
resultant page is there at the end.
main file :
<?php
$title = "Hello World";
include("header.inc");
$result = mysql_query("SELECT * FROM employees",$db);
echo "<table border=1>\n";
echo "<tr><td>Name</td><td>Position</tr>\n";
while ($myrow = mysql_fetch_row($result)) {
printf("<tr><td>%s %s</td><td>%s</tr>\n", $myrow[1],
$myrow[2], $myrow[3]);
}
echo "</table>\n";
include("footer.inc");
?>
header.inc
<?php
$db = mysql_connect("localhost", "root");
mysql_select_db("mydb",$db);
?>
<html>
<head>
<title>
<?php echo $title ?>
</title>
</head>
<body>
<center><h2><?php echo $title ?></h2></center>
footer.inc
mysql_close("$db");
echo"</body>";
echo"</html>";
The resultant page is :-
Warning: Failed opening 'header.inc' for inclusion in c:\apache\htdocs\hello.php3 on line
5
Warning: 0 is not a MySQL link index in c:\apache\htdocs\hello.php3 on line 7
Name Position
Warning: 0 is not a MySQL result index in c:\apache\htdocs\hello.php3 on line 13
Warning: Failed opening 'footer.inc' for inclusion in c:\apache\htdocs\hello.php3 on line
21
Thanx
Anurag