Re: problems with require...

From: Date: Fri, 16 Feb 2001 05:12:09 +0000
Subject: Re: problems with require...
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-6681@lists.php.net to get a copy of this message
Try using the full path to your include or require file... see if that works. inlude("D:\Inetpub\paulberry\press.inc"); The include_path is a list of directories where php should expect to find files. Yours appears to be empty. Edit your php.ini to change this. I don't remember if the current directory is implicitly included or not... If you only include files in the same directory as the rest of your working files (where your main.php file is) you could set include_path="." ( just the period). You might want to create a d:\inetpub\php\include directory and add it to the path for includes you use in all projects. Then you might set your include_path="d:\inetpub\php\incude;." Best wishes, -joe "shmengie" ----- Original Message ----- From: <dave@dwiwebdesign.co.uk> Newsgroups: php.db Sent: Tuesday, February 13, 2001 7:30 PM Subject: [PHP-DB] problems with require... > Hi everyone; > > I have only started to program in php over the past month or so. > but I'm some problems with this bit of code below. > > error message is: > > Fatal error: failed opening required "press.inc" (include_path=") in > D:\Inetpub\paulberry\main.php on line 201 > > I'm passing the values of main.php?pageid=1 > If I manually place press.inc it works OK.. > > Does anyone know can you place variables in the require statement ?? > > > <?php > // create connection > $connection = mysql_connect("localhost","****","****") or > die("Couldn't make connection."); > // select database > $db = mysql_select_db("paulberrydb", $connection) or die("Couldn't > select database."); > // create SQL statement > $sql = "select id, title, includefile from pages where id=$pageid"; > // execute SQL query and get result > $sql_result = mysql_query($sql,$connection) or die("Couldn't execute > query."); > // start results formatting > // format results by row > while ($row = mysql_fetch_array($sql_result)) { > $title = $row["title"]; > $includefile = $row["includefile"]; > echo "<p class='title'>$title</p>"; > echo "</TD>"; > echo "</TR>"; > echo "<TR>"; > echo "<TD height=75 align='left' valign='top'>"; > echo "<P>"; > > ************************************** > Problem area > > require('$includefile.inc'); > > *************************************** > > I also tried this.. > > $includef = "'$includefile"; > $includef .=".inc'"; > require($includef); > > *************************************** > > > echo "</TD>"; > echo "</TR></TBODY></TABLE>"; > } > // free resources and close connection > mysql_free_result($sql_result); > mysql_close($connection); > ?> > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > David Irwin > DWI Web Design > E-Mail: dave@dwiwebdesign.co.uk > Http: www.dwiwebdesign.co.uk > Tel: 028 38891537 > Mobile: 07968483610 > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

« previous php.db (#6681) next »