close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Generate the wrong recordset in DA !

Thread began 10/14/2009 7:42 pm by kakadong | Last modified 10/16/2009 9:22 am by Jason Byrnes | 1278 views | 3 replies |

kakadong

Generate the wrong recordset in DA !

I use the wizard to make a backend ....
when I finished, it generate 6 pages for me ..
results,details,insert,delete,update,search....

but some error in recordsets which DA generate....

the update, details , delete pages has the error...

the delete page code generate by DA :

<?php
$ParamAgent_ID_WADAagent_profile = "-1";
if (isset($_GET['Agent_ID'])) {
$ParamAgent_ID_WADAagent_profile = (get_magic_quotes_gpc()) ? $_GET['Agent_ID'] : addslashes($_GET['Agent_ID']);
}
mysql_select_db($database_connection, $connection);
$query_WADAagent_profile = sprintf("SELECT Agent_ID, Agent_Name, Agent_Identity, Agent_Birth, Telephone_Home, Telephone_mobile, E_Mail, County_ID, Town_ID, Zip_ID, Road, Bank_ID, Bank_Account, Level_ID, User_Name, Pass_Word FROM agent_profile WHERE Agent_ID = %s", GetSQLValueString($ParamAgent_ID_WADAagent_profile, "int"));
$WADAagent_profile = mysql_query($query_WADAagent_profile, $connection) or die(mysql_error());
$row_WADAagent_profile = mysql_fetch_assoc($WADAagent_profile);
$totalRows_WADAagent_profile = mysql_num_rows($WADAagent_profile);?>

the detail page :
<?php
$ParamAgent_ID_WADAagent_profile = "-1";
if (isset($_GET['Agent_ID'])) {
$ParamAgent_ID_WADAagent_profile = (get_magic_quotes_gpc()) ? $_GET['Agent_ID'] : addslashes($_GET['Agent_ID']);
}
$ParamSessionAgent_ID_WADAagent_profile = "-1";
if (isset($_SESSION['WADA_Insert_agent_profile'])) {
$ParamSessionAgent_ID_WADAagent_profile = (get_magic_quotes_gpc()) ? $_SESSION['WADA_Insert_agent_profile'] : addslashes($_SESSION['WADA_Insert_agent_profile']);
}
$ParamAgent_ID2_WADAagent_profile = "-1";
if (isset($_GET['Agent_ID'])) {
$ParamAgent_ID2_WADAagent_profile = (get_magic_quotes_gpc()) ? $_GET['Agent_ID'] : addslashes($_GET['Agent_ID']);
}
mysql_select_db($database_connection, $connection);
$query_WADAagent_profile = sprintf("SELECT Agent_ID, Agent_Name, Agent_Identity, Agent_Birth, Telephone_Home, Telephone_mobile, E_Mail, County_ID, Town_ID, Zip_ID, Road, Bank_ID, Bank_Account, Level_ID, User_Name, Pass_Word FROM agent_profile WHERE Agent_ID = %s OR ( -1= %s AND Agent_ID= %s)", GetSQLValueString($ParamAgent_ID_WADAagent_profile, "int"),GetSQLValueString($ParamAgent_ID2_WADAagent_profile, "int"),GetSQLValueString($ParamSessionAgent_ID_WADAagent_profile, "int"));
$WADAagent_profile = mysql_query($query_WADAagent_profile, $connection) or die(mysql_error());
$row_WADAagent_profile = mysql_fetch_assoc($WADAagent_profile);
$totalRows_WADAagent_profile = mysql_num_rows($WADAagent_profile);?>

the update page :
<?php
$ParamAgent_ID_WADAagent_profile = "-1";
if (isset($_GET['Agent_ID'])) {
$ParamAgent_ID_WADAagent_profile = (get_magic_quotes_gpc()) ? $_GET['Agent_ID'] : addslashes($_GET['Agent_ID']);
}
mysql_select_db($database_connection, $connection);
$query_WADAagent_profile = sprintf("SELECT Agent_ID, Agent_Name, Agent_Identity, Agent_Birth, Telephone_Home, Telephone_mobile, E_Mail, County_ID, Town_ID, Zip_ID, Road, Bank_ID, Bank_Account, Level_ID, User_Name, Pass_Word FROM agent_profile WHERE Agent_ID = %s", GetSQLValueString($ParamAgent_ID_WADAagent_profile, "int"));
$WADAagent_profile = mysql_query($query_WADAagent_profile, $connection) or die(mysql_error());
$row_WADAagent_profile = mysql_fetch_assoc($WADAagent_profile);
$totalRows_WADAagent_profile = mysql_num_rows($WADAagent_profile);?>

when i double click the server behavior trying to make it correct
and click the test button..
the errors shows ....



can any body help me??

OS: win7 traditional chinese
DW cs4 english

Attached Files
delete.zip
detail.zip
error_php.zip
update.zip
Sign in to reply to this post

Jason ByrnesWebAssist

This problem is caused by a the way Dreamweaver reads variables and using the Underscore Character in your column names.



When a variable is created in a recordset it is name "Param<ColumnName>". Dreamweaver writes the code for the parameter as "$Param<ColumnName>_<RecordsetName>.


upon re inspection, Dreamweaver sees everything after the first underscore character as the recordset name. so the column "Agent_ID" in the "WADAagent_profile" recordset will be named:
ParamAgent_ID

the code for the variable will be written as:
$ParamAgent_ID_WADAagent_profile


When you reinspect the recordset, Dreamweaver will read the parameter name as:
ParamAgent


and the recordset it is associated with as:
ID_WADAagent_profile

To keep the issue from occurring, you should avoid underscores in your column names.

To fix the problem, you will need to manually edit the code, and remove the underscores from the variabel names. change any instance of:
$ParamAgent_ID_WADAagent_profile

on the delete page to:
$ParamAgentID_WADAagent_profile


on the detail page, change these three:
$ParamAgent_ID_WADAagent_profile

$ParamSessionAgent_ID_WADAagent_profile

$ParamAgent_ID2_WADAagent_profile


to:
$ParamAgentID_WADAagent_profile

$ParamSessionAgentID_WADAagent_profile

$ParamAgentID2_WADAagent_profile



On the update page, change:
$ParamAgent_ID_WADAagent_profile

to:
$ParamAgentID_WADAagent_profile

Sign in to reply to this post

kakadong

It seems fine!

after handcoding, it seems fine...
thanks for helping!

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

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