script failing not sure why
Posted: Tue Feb 01, 2005 3:46 am
Script failing, not sure why
Hello Pros...
This amateur is having trouble again!
The site is http://www.ealingcc.co.uk which is based on PHP and a MySQL database.
Content is delieverd by finding out the directory and delivering the correct data accordingly. Most of the time it works... but every ten or so clicks it fails.... the script is below (the comment below in bold is where it occasionally seems to fail)... any ideas?
quote:
/* this section gets the directory and delivers content based on it... ie cricket, facilities etc Seems to work*/
<?
if (!session_is_registered("output"))
{
session_register("output");
}
$pwd = pathinfo(getcwd());
$directory = $pwd['basename'];
$output = $directory;
/* my functions etc */
require ("../funcs/variables.php");
require("../funcs/funcs_display.php");
require("../funcs/modules_display.php");
require("../funcs/db_funcs.php");
?>
<html>
<head>
<title><? echo $browser_title ?></title>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="../temp_01/cssfile.css">
</head>
/* this bit gets the page type, and this is the bit causing trouble, sometimes it doesn't seem to work */
<?php
$pgtype_array = get_www($output);
if (!is_array($pgtype_array))
{
echo 'Nothing to display';
return;
}
foreach ($pgtype_array as $row)
{
$pgtype1 = $row['pgtype1'];
$pgtype2 = $row['pgtype2'];
$pgtype3 = $row['pgtype3'];
$pgtype4 = $row['pgtype4'];
$pgtype5 = $row['pgtype5'];
}
/* and this bit gets the content based on the page type, which obviously fails if the above fails */
if ($pgtype1 == 'md1')
{
require ("../temp_01/tm_01_header_01.php");
$title1_array = get_www($output);
extract_mod1_title1($title1_array);
$page1_array = get_www($output);
extract_mod1_text1($page1_array);
require ("../temp_01/tm_01_footer_01.php");
exit;
}
if ($pgtype1 == 'md2')
{
require("../temp_01/tm_01_header_02.php");
$title1_array = get_www($output);
extract_mod2_title1($title1_array);
$page1_array = get_www($output);
extract_mod2_text1($page1_array);
require("../temp_01/tm_01_footer_02.php");
exit;
}
if ($pgtype1 == 'md3')
etc etc etc
Hello Pros...
This amateur is having trouble again!
The site is http://www.ealingcc.co.uk which is based on PHP and a MySQL database.
Content is delieverd by finding out the directory and delivering the correct data accordingly. Most of the time it works... but every ten or so clicks it fails.... the script is below (the comment below in bold is where it occasionally seems to fail)... any ideas?
quote:
/* this section gets the directory and delivers content based on it... ie cricket, facilities etc Seems to work*/
<?
if (!session_is_registered("output"))
{
session_register("output");
}
$pwd = pathinfo(getcwd());
$directory = $pwd['basename'];
$output = $directory;
/* my functions etc */
require ("../funcs/variables.php");
require("../funcs/funcs_display.php");
require("../funcs/modules_display.php");
require("../funcs/db_funcs.php");
?>
<html>
<head>
<title><? echo $browser_title ?></title>
<LINK REL="STYLESHEET" TYPE="text/css" HREF="../temp_01/cssfile.css">
</head>
/* this bit gets the page type, and this is the bit causing trouble, sometimes it doesn't seem to work */
<?php
$pgtype_array = get_www($output);
if (!is_array($pgtype_array))
{
echo 'Nothing to display';
return;
}
foreach ($pgtype_array as $row)
{
$pgtype1 = $row['pgtype1'];
$pgtype2 = $row['pgtype2'];
$pgtype3 = $row['pgtype3'];
$pgtype4 = $row['pgtype4'];
$pgtype5 = $row['pgtype5'];
}
/* and this bit gets the content based on the page type, which obviously fails if the above fails */
if ($pgtype1 == 'md1')
{
require ("../temp_01/tm_01_header_01.php");
$title1_array = get_www($output);
extract_mod1_title1($title1_array);
$page1_array = get_www($output);
extract_mod1_text1($page1_array);
require ("../temp_01/tm_01_footer_01.php");
exit;
}
if ($pgtype1 == 'md2')
{
require("../temp_01/tm_01_header_02.php");
$title1_array = get_www($output);
extract_mod2_title1($title1_array);
$page1_array = get_www($output);
extract_mod2_text1($page1_array);
require("../temp_01/tm_01_footer_02.php");
exit;
}
if ($pgtype1 == 'md3')
etc etc etc