PDA

View Full Version : Includes and Database behaviors


kona72
05-07-2006, 09:50 PM
Hey All,

Something really quirky here in DW or maybe i am just missing something. I am building a site and using a basic table layout with includes... mostly for something different and to push me out of my comfort zone. Here is the table itself....

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>

<body>
<table width="775" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top"></td>
</tr>
<tr>
<td align="left" valign="top"><table width="775" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top">
<td></td>
<td></td>
<td></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top"></td>
</tr>
</table>
</body>
</html>

And here is a page with the includes.....

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Carly Henry</title>
<link href="carlystyle.css" rel="stylesheet" type="text/css">
</head>

<body>

<div align="center">
<table width="775" border="0" cellspacing="0" cellpadding="0" background="images/body_bg.jpg">

<tr>
<td align="left" valign="top"><?php include('header.php') ;?></td>
</tr>

<tr>
<td align="left" valign="top"><table width="775" border="0" cellspacing="0" cellpadding="0">
<tr align="left" valign="top" >
<td width="170"><?php include('lt_col.php'); ?></td>
<td width="434"><?php include ('includes/welcome.php') ;?></td>
<td width="171" ><?php include ('rt_col.php') ;?></td>
</tr>
</table></td>
</tr>
<tr>
<td align="left" valign="top"><?php include('footer.php'); ?></td>
</tr>
</table>
</div>
</body>
</html>

When I use an include and the file to be included is in the root directory everything is fine. BUT when i try to use an include and it is the root but within a folder such as an includes folder it doesn't want to work right; especially if it has database queries. I'm not sure if i am doing something wrong or what, i look at the code and everything seems goos but when i go to look at the site it doesn't display??? If any one uses includes on a regular basis I woudl really appreciate some pointers....

Here is a sample include file that uses DB queries. I initially had it within a folder called 'includes' makes sense. BUT it would not query; once i moved this page out of the folder and into the root.. it worked fine...

<?php require_once('Connections/CarlyHenry.php'); ?>
<?php
mysql_select_db($database_CarlyHenry, $CarlyHenry);
$query_rsAllevents = "SELECT `date`, event, `desc`, location FROM schedule ORDER BY `date` DESC";
$rsAllevents = mysql_query($query_rsAllevents, $CarlyHenry) or die(mysql_error());
$row_rsAllevents = mysql_fetch_assoc($rsAllevents);
$totalRows_rsAllevents = mysql_num_rows($rsAllevents);
?>

<table width="434" border="0" cellspacing="0" cellpadding="5">
<tr>
<td align="left" valign="top">

images/cabaret.jpg</p>
</td>
</tr>
<tr>
<td align="left" valign="top"><?php do { ?>
<table width="430" border="0" cellspacing="0" cellpadding="0">
<tr>
<td align="left" valign="top">

<?php echo $row_rsAllevents['date']; ?>

<?php echo $row_rsAllevents['event']; ?>

<?php echo $row_rsAllevents['desc']; ?>

<?php echo $row_rsAllevents['location']; ?> </p>


</p></td>
</tr>
</table>
<?php } while ($row_rsAllevents = mysql_fetch_assoc($rsAllevents)); ?>


</p>
</td>
</tr>
</table>

<?php
mysql_free_result($rsAllevents);
?>