close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 or 2018 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Getting MySQL errors on pages created with dataassist and upload file

Thread began 2/28/2011 7:00 am by mrs | Last modified 3/11/2011 11:42 am by mrs | 2056 views | 7 replies

mrs

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.

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...