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: [EMAIL PROTECTED]
Http: www.dwiwebdesign.co.uk
Tel: 028 38891537
Mobile: 07968483610
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~