Is it faster to have a lot of include files so you can call functions to display the content you want on the page? Or not include anything really and each page has queries?
What I'm asking is there a way to make this faster?
<?
//Include files
require_once("includes/db_fns.php");
if(!db_connect()){
echo "error connection to database";
exit;
}
?>
<html>
<head>
<title>.: pug's/deviant/world :.</title>
<link rel="stylesheet" href="includes/stylesheet.css" type="text/css">
</head>
<body>
<br><br>
<a name="top"></a>
<table width="750" border="0" cellspacing="1" cellpadding="3" bgcolor="#000000" align="center">
<tr bgcolor="#101842">
<td colspan="3"><font face="Superkarcher"> <font color="#DEB500" size="6" face="Verdana, Arial, Helvetica, sans-serif"><b><font size="4">></font></b></font><font size="4"><b><font face="Verdana, Arial, Helvetica, sans-serif">
.: pug's/deviant/world :.</font></b></font></font></td>
</tr>
<tr bgcolor="#354463">
<td colspan="3"><font size="2" color="#CCCCCC"><b><font face="Verdana, Arial, Helvetica, sans-serif" size="1" color="#DEB500"><? echo date("l, M:d:y | g.i.s a T");?></font></b></font></td>
</tr>
<tr>
<td bgcolor="#253047" valign="top" width="3"> </td>
<td valign="top" bgcolor="#CCCCCC"><b></b>
<table width="100%" border="0" cellspacing="2" cellpadding="3">
<tr>
<td valign="top">
<table border=0 width="100%" cellspacing="0" cellpadding="1" align="center">
<?
//Display news
$query = "SELECT * FROM news ORDER BY date desc, time desc";
$result = mysql_query($query);
if(!$result)
echo "Error running the query";
$num_rows = mysql_num_rows($result);
//Print each news article
for ($i=0; $i < $num_rows; $i++)
{
$row = mysql_fetch_array($result);
//Headline with date and time
echo "<tr>";
echo "<td class='big' width='50%'>:: ";
echo $row['headline'];
echo "</td>";
echo "<td class='infohead' width='50%' align='right'>Posted ";
echo $row['date'];
echo " | ";
echo $row['time'];
echo "</td>";
echo "</tr>";
//News text
echo "<tr valign='top'>";
echo "<td colspan='2' class='content'>";
echo "<p>";
echo $row['news'];
echo "</p>";
echo "</td>";
echo "</tr>";
}
?>
</table>
</td>
<td valign="top" width="200">
<table border="0" cellpadding="2" cellspacing="1" bgcolor="#000000" width="100%">
<tr bgcolor="#101842">
<td class="small">
<div align="center"><b>:: NAVIGATION :.</b></div>
</td>
</tr>
<?
//Display each site link
$site_query = "SELECT linkname, linkpath FROM sitelinks WHERE showable=1 ORDER BY linkid";
$result = mysql_query($site_query);
if(!$result)
echo "Error running the query";
$num_of_site_links = mysql_num_rows($result);
for ($i=0; $i < $num_of_site_links; $i++)
{
$site_links = mysql_fetch_array($result);
echo "<tr bgcolor='#354463'>";
echo "<td class='small' align='center'>";
echo "<div align='left'><font color='#e9f2fc'>";
echo "<a href='";
echo $site_links["linkpath"];
echo "'>[X] ";
echo $site_links["linkname"];
echo "</a>";
echo "</font></div></td></tr>";
}
?>
</table>
<br>
<table cellspacing="1" cellpadding="2" border="0" bgcolor="#00000" width="100%" align="center">
<tr>
<td class="infohead" width="194"><b>:: Nothing here yet :.</b></td>
</tr>
<tr>
<td height="101" valign="top" class="info">
</td>
</tr>
<tr>
<td class="infohead" width="194"><b>:: Links :.</b></td>
</tr>
<tr>
<td height="101" valign="top" class="info">
<?
$query = "SELECT linkname, linkpath FROM links ORDER BY linkid";
$result = mysql_query($query);
if(!$result)
echo "Error running the query";
$num_rows = mysql_num_rows($result);
//Display each site link
echo "<div align=center>";
for ($i=0; $i < $num_rows; $i++)
{
$row = mysql_fetch_array($result);
echo "<a href=";
echo $row["linkpath"];
echo ">";
echo $row["linkname"];
echo "</a>";
echo "<br><br>";
}
echo "</div>";
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td bgcolor="#253047" valign="top" width="5"> </td>
</tr>
<tr bgcolor="#354463">
<td colspan="3">
<div align="center"><a href="#top">^TOP</a> : <font color="#e9f2fc">
<?
$result = mysql_query($site_query);
if(!$result)
echo "Error running the query";
$num_of_site_links = mysql_num_rows($result);
for ($i=0; $i < $num_of_site_links; $i++)
{
$site_links = mysql_fetch_array($result);
echo "<a href='";
echo $site_links["linkpath"];
echo "'>[X] ";
echo $site_links["linkname"];
echo "</a> : ";
}
?>
</font>
</div>
</td>
</tr>
<tr bgcolor="#101842">
<td colspan="3">
<div align="right"><font size="1"><b>All Content © 2003 C.Beam<br>
</b></font> </div>
</td>
</tr>
</table>
</body>
</html>