close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Weird SQL duplication on Recordset update

Thread began 7/12/2011 10:40 am by Jared Lui | Last modified 7/12/2011 3:56 pm by Jared Lui | 623 views | 2 replies

Jared Lui

Jason explained how this is happening and why.

This is caused by a conflict in my column naming convention and how DW and DA deal with naming parameters. This could be explained better I am sure but that is the gist of it.

Because I use an underscore in my column names DW was giving me errors trying to save recordsets when DA would create parameters which conflict with my column names.

In short, if you get an error when using the Test button in the recordset that says:
ParamX is an invalid variable name; it does not appear in the SQL
Missing type for variable:ParamX
NOTE: where "X" is the column name

Chances are that you have underscores in your column names. This also can cause duplicate select statements to be created. Best practice is to use camelCase for file names (thanks Jason). But to fix this in your code just remove the underscore in the parameter like the example below where Figure_Id is my column name. DA created a parameter called: $ParamFigure_Id_WADAfigures and apparently the first underscore is the problem. So just remove all instances of the first underscore so it looks like this: $ParamFigureId_WADAfigures.

The code below was where the problem is. I removed the first underscore in all three places and it corrected my issue.

<?php
$ParamFigure_Id_WADAfigures = "-1";
if (isset($_GET['Figure_Id'])) {
$ParamFigure_Id_WADAfigures = (get_magic_quotes_gpc()) ? $_GET['Figure_Id'] : addslashes($_GET['Figure_Id']);
}
mysql_select_db($database_FIGURES, $FIGURES);
$query_WADAfigures = sprintf("SELECT Figure_Id, Figure_Name, Date_Stamp, Size, Figure_Added, Series_Id, Line_Id, Figure_Approve, Figure_Locked, Figure_Text, Figure_Text_Added, Figure_Text_Approved FROM figures WHERE Figure_Id = %s", GetSQLValueString($ParamFigure_Id_WADAfigures, "int"));
$WADAfigures = mysql_query($query_WADAfigures, $FIGURES) or die(mysql_error());
$row_WADAfigures = mysql_fetch_assoc($WADAfigures);
$totalRows_WADAfigures = mysql_num_rows($WADAfigures);?>

Hope this helps someone.
Cheers!

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