multiple function query
Posted: Mon May 12, 2003 4:17 am
I have created two functions which will work in connection with each other I dont know if it's silly to do this but I thought it was worth the try:
One function creates the html page and the other calls info from a db and lays it out neatly.
I have placed the second function within the first one to display the info correctly. All the info is displayed but in the incorrect order, it seems to be displaying the second functions info first and then the first one. Why would this happen ?? The code is as follows:
(mod edit: changed
THanks all
One function creates the html page and the other calls info from a db and lays it out neatly.
I have placed the second function within the first one to display the info correctly. All the info is displayed but in the incorrect order, it seems to be displaying the second functions info first and then the first one. Why would this happen ?? The code is as follows:
(mod edit: changed
Code: Select all
toCode: Select all
, easier to read )Code: Select all
include ("scripts/conf.php");
//this function will create the basic outlay for the html section of the page
function html_page_content($infofill)
{
echo "<html><head><title>page filler info</title></head>
<body topmargin='0' leftmargin='0' marginheight='0' marginwidth='0'>
<table width='329' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td width='21'><img src='../images/spacer.gif' width='21' height='8'></td>
<td width='379' colspan='2'><img src='images/mustek%20big%20logo.gif' width='270' height='81'></td>
</tr>
<tr>
<td> </td>
<td colspan='2'> </td>
</tr>
<tr>
<td valign='top'> </td>
<td colspan='2' align='center' valign='top'> </td>
</tr>
<tr>
<td colspan='3'>" . $infofill .
"</td>
</tr>
<tr>
<td> </td>
<td colspan='2'> </td>
</tr>
</table>
</body>
</html>";
}
//this function places the specifics of the page within the table
function info($block_type, $arrow_type)
{
//Query requested info from the table
global $result, $query, $pageType;
$query = "SELECT * FROM sitecontent WHERE section = '$pageType' ORDER BY contentid";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
$row = mysql_fetch_object($result);
echo "<table width='329' border='0' cellpadding='0' cellspacing='0'><tr>
<td width='21' valign='top'><img src='images/" . $block_type ."' width='21' height='9'></td>
<td width='308' colspan='2' align='center' valign='top'>
<table width='95%' border='0' cellspacing='0' cellpadding='0'>
<tr><td>" . $row->SubSection . "
<img src='images/" . $arrow_type . "' width='10' height='10'></td>
</tr><tr>
<td><br>";
while (mysql_fetch_object($result))
{
//$subheading =
echo $row->SubSection . "<p>" . $row->Body . "</p>";
//echo $subheading;
}
echo "</td></tr></table></td></tr></table>";
}
html_page_content(1);
info("about_block.gif", "about_arrow.gif")