RE: [PHP] "include() "function in windows !
| From: | Chris Sano | Date: | Thu, 29 Jun 2000 23:56:46 +0000 |
| Subject: | RE: [PHP] "include() "function in windows ! | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-3942@lists.php.net to get a copy of this message | ||
Your problem probably lies in the httpd.conf file
Look for the include_path and put the include files there.
Chris
-----Original Message-----
From: Anurag Bhalla [mailto:anuragbhalla@id.eth.net]
Sent: Thursday, June 29, 2000 10:27 PM
To: php-general@lists.php.net
Subject: [PHP] "include() "function in windows !
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