Hi Jason, I have noticed that the ordering of included files is causing some issues. For some reason, when I create the pages via datassist, the connections file, the globals file and others are getting pushed below all of the DB selects and ending up just above <! DOCTYPE html... and obviously this is causing a situation where DB content is trying to be called upon before the document realises that there is even a DB available!!
Here's the code:
<?php require_once( "../WA_SecurityAssist/Helper_PHP.php" ); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
?>
<?php
$currentPage = $_SERVER["PHP_SELF"];
?>
<?php
$maxRows_WADAheadimages = 5;
$pageNum_WADAheadimages = 0;
if (isset($_GET['pageNum_WADAheadimages'])) {
$pageNum_WADAheadimages = $_GET['pageNum_WADAheadimages'];
}
$startRow_WADAheadimages = $pageNum_WADAheadimages * $maxRows_WADAheadimages;
mysql_select_db($database_localhost, $localhost);
$query_WADAheadimages = "SELECT id, image FROM headimages";
$query_limit_WADAheadimages = sprintf("%s LIMIT %d, %d", $query_WADAheadimages, $startRow_WADAheadimages, $maxRows_WADAheadimages);
$WADAheadimages = mysql_query($query_limit_WADAheadimages, $localhost) or die(mysql_error());
$row_WADAheadimages = mysql_fetch_assoc($WADAheadimages);
if (isset($_GET['totalRows_WADAheadimages'])) {
$totalRows_WADAheadimages = $_GET['totalRows_WADAheadimages'];
} else {
$all_WADAheadimages = mysql_query($query_WADAheadimages);
$totalRows_WADAheadimages = mysql_num_rows($all_WADAheadimages);
}
$totalPages_WADAheadimages = ceil($totalRows_WADAheadimages/$maxRows_WADAheadimages)-1;
?>
<?php
$queryString_WADAheadimages = "";
if (!empty($_SERVER['QUERY_STRING'])) {
$params = explode("&", $_SERVER['QUERY_STRING']);
$newParams = array();
foreach ($params as $param) {
if (stristr($param, "pageNum_WADAheadimages") == false &&
stristr($param, "totalRows_WADAheadimages") == false) {
array_push($newParams, $param);
}
}
if (count($newParams) != 0) {
$queryString_WADAheadimages = "&" . htmlentities(implode("&", $newParams));
}
}
$queryString_WADAheadimages = sprintf("&totalRows_WADAheadimages=%d%s", $totalRows_WADAheadimages, $queryString_WADAheadimages);
?>
<?php
//WA AltClass Iterator
class WA_AltClassIterator {
var $DisplayIndex;
var $DisplayArray;
function WA_AltClassIterator($theDisplayArray = array(1)) {
$this->ClassCounter = 0;
$this->ClassArray = $theDisplayArray;
}
function getClass($incrementClass) {
if (sizeof($this->ClassArray) == 0) return "";
if ($incrementClass) {
if ($this->ClassCounter >= sizeof($this->ClassArray)) $this->ClassCounter = 0;
$this->ClassCounter++;
}
if ($this->ClassCounter > 0)
return $this->ClassArray[$this->ClassCounter-1];
else
return $this->ClassArray[0];
}
}
?><?php
//WA Alternating Class
$WARRT_AltClass1 = new WA_AltClassIterator(explode("|", "WADAResultsRowDark|"));
?>
<?php require_once( "../WA_Globals/WA_Globals.php" ); ?>
<?php require_once('../Connections/localhost.php'); ?>
<?php require_once( "../WA_CMS/WA_CMS.php" ); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http:...
Basically, what I have done is move the three php require once lines to the top of the code, and moved the connections code to the top of that, and suddenly the results page is working. So, what's happening is that I run the dataassist extension, and the code being created is being placed in the wrong order!
Is there any reason for this? I assume it's a bug. It's happening on all pages created this way, so I am guessing that I can rectify my problems without the need to have you contact me and waste your time on most of the pages I am struggling with, but I'll keep you posted on that, so don't close the ticket just yet as it doesn't explain why pre-existing pages no longer upload.
Bear with me and I'll get back to you.
Thanks.