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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

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 Jason Byrnes | 2049 views | 7 replies |

mrs

Getting MySQL errors on pages created with dataassist and upload file

Hi, I have used site sculptor to build a site which has been up and running for a few years now, and I have been asked to add a few upload capabilities to the site.

So, I used data assist to create the pages, and then I used the file manipulation upload that came with css form builder to add upload capabilities to the insert and update pages, however, I am getting these errors:

On the insert page:

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/fhlinux133/g/website.com/user/htdocs/admin/headimages_Insert.php on line 42

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fhlinux133/g/website.com/user/htdocs/admin/headimages_Insert.php on line 46

Line 42 is: mysql_select_db($WA_connectionDB, $WA_connection);

Line 46 is: $MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());

What has me bemused is that both the upload and the database insert have worked, but the page still errors!


On the results page:

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/fhlinux133/g/website.com/user/htdocs/admin/headimages_Results.php on line 45

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in /home/fhlinux133/g/website.com/user/htdocs/admin/headimages_Results.php on line 48

Line 45 is: }

Line 48 is: mysql_select_db($database_localhost, $localhost);

With this page, there is nothing happening other than the data being called into the page... no inserts or uploads whatsoever


The trouble is, I can see the insert and results pages on my localhost, but I can only see the insert page on the remote server. The error on the insert page both locally and remotely is coming after I click upload.


IT GETS WORSE!!

It seems that as a result of upgrading to the latest versions of software (CSS form Builder and HTML editor 3) and then uploading the helper files and other includes that are used by data assist and file manipulation upload, a previous upload facility is no longer working... I constantly seem to be revisiting pages of sites that were previously working whenever I try to add new pages. This is frustrating for me as I m now getting a rollocking from my client!

I really need some guidance here. I have used data assist more times than I can remember, and I have used it successfully in the past with this particular site even though the site was initially created with site sculptor. I have also used file upload lots of times with little problem, and never before has it seemed to cause problems with previously built pages.

Sign in to reply to this post

mrs

With the admin pages, I am also getting this error with the CSSmenuWriter files made from the site sculptor process on my localhost, but not on the remote host. This didn't happen before I started to add the new upload capabilities:

Deprecated: Function split() is deprecated in /Users/matthewstuart/Sites/ginnygray/CSSMenuWriter/cssmw/menu.php on line 16

Line 16 is: $WA_ddsArray = split("/", $WA_thisFile);

I have checked the path in the globals file, and it seems correct, and on the basis that the menu is navigating properly, I assume it has nothing to do with that.

Sign in to reply to this post

Jason ByrnesWebAssist

I have created a support ticket so we can look into this issue further.

To view and edit your support ticket, please log into your support history:
supporthistory.php

Sign in to reply to this post

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.

Sign in to reply to this post

Jason ByrnesWebAssist

the only that will need to be moved is the connection line:
<?php require_once('../Connections/localhost.php'); ?>

I have verified this happens if the connection line is already on the page before the wizard is run and logged this as a bug, thanks for bringing it to our attention.

if the connection line is not on the page before running the wizard, the code is placed in the correct order.

Sign in to reply to this post

mrs

I know it's been some time since I responded to this, but I have been busy!!

Anyways, what I have done is remove the css menu writer content from the power cms template and simply add straight forward text links which has overcome the error of: Deprecated: Function split() is deprecated in /Users blah blah...

What is now happening is that I am getting a problem where the pages 'Contents_Results.php' and 'Contents_Insert.php' now won't display due to this error:

Safari can’t open the page.
Safari can’t open the page “Contents_Insert.php” because the server unexpectedly dropped the connection. This sometimes occurs when the server is busy. Wait for a few minutes, and then try again.

However, the server isn't too busy to show other pages such as the admin home page or even detail and update pages. I have tried many different times and at various times throughout the day and night through to the early hours of the morning. The pages work perfectly well on my localhost, so I really don't know how to get over this problem!

Have you got any advice? Do I need to proceed to the tech support ticket that you have instigated on this now?

Thanks.

Sign in to reply to this post

mrs

I am sure I saw some code on the webassist site to show php errors, but I can't find it if it does exist. Can you tell me where I can get it from please?

Perhaps I might be able to figure out what the problem is that way.

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

the fix for the deprecated function error is to change:
$WA_ddsArray = split("/", $WA_thisFile);

to:
$WA_ddsArray = explode("/", $WA_thisFile);


this error should be fixed in newer version of menu writer.

code for displaying error is:

php:
<?php
error_reporting
(E_ALL);
ini_set('display_errors','on');
?>




if there is still no error showing on the page, contact the host to see if they can investigate the PHP servers error log to track the error down.

Sign in to reply to this post

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...