close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

strange recordset entries when underscore

Thread began 9/30/2009 12:51 am by office377308 | Last modified 10/05/2009 3:22 pm by Eric Mittman | 5951 views | 14 replies |

office377308

strange recordset entries when underscore

When I try to apply the data assist wizard a strange behaviour occurs: If you take a look at the recordset you find a couple of missing params:
this is the code view:
<?php
$Paramkmysql_id_WADAkunden_mysql = "-1";
if (isset($_GET['kmysql_id'])) {
$Paramkmysql_id_WADAkunden_mysql = (get_magic_quotes_gpc()) ? $_GET['kmysql_id'] : addslashes($_GET['kmysql_id']);
}
$Paramkmysql_id2_WADAkunden_mysql = "-1";
if (isset($_GET['kmysql_id'])) {
$Paramkmysql_id2_WADAkunden_mysql = (get_magic_quotes_gpc()) ? $_GET['kmysql_id'] : addslashes($_GET['kmysql_id']);
}
$ParamSessionkmysql_id_WADAkunden_mysql = "-1";
if (isset($_GET['kmysql_id'])) {
$ParamSessionkmysql_id_WADAkunden_mysql = (get_magic_quotes_gpc()) ? $_GET['kmysql_id'] : addslashes($_GET['kmysql_id']);
}
mysql_select_db($database_lokal, $lokal);
$query_WADAkunden_mysql = sprintf("SELECT kmysql_id, kunden_id, mysql_server, mysql_db, mysql_login, mysql_passwd, changed FROM kunden_mysql WHERE kmysql_id = %s OR ( -1= %s AND kmysql_id= %s)", GetSQLValueString($Paramkmysql_id_WADAkunden_mysql, "int"),GetSQLValueString($Paramkmysql_id2_WADAkunden_mysql, "int"),GetSQLValueString($ParamSessionkmysql_id_WADAkunden_mysql, "int"));
$WADAkunden_mysql = mysql_query($query_WADAkunden_mysql, $lokal) or die(mysql_error());
$row_WADAkunden_mysql = mysql_fetch_assoc($WADAkunden_mysql);
$totalRows_WADAkunden_mysql = mysql_num_rows($WADAkunden_mysql);
?>
now take a look at the screenshots. You will notice that the URL params have disappeared whenever there is an underscore involved.

This only seems to happen if in the mysql database there are fields with underscores like "kunden_id"

Sign in to reply to this post

jenkolaka19379118

I having the exact same error, I have alot of underscores in my table fields too. I really need help to fix this as i cannot modify my recordsets anymore because I get that same error message.

Sign in to reply to this post

jenkolaka19379118

Is there a way to fix this without having to change my database? will the update_page still work? this is the page that is coming up with this error.

I get this error message

  param[tablename] is an invalid variable name; it does not appear in the SQL

Missing Run-Time Value for variable;table_id  



in my recordset variable panel i get these 2 variables

param[tablename]
param[tableid]

The php code is

<?php
$Paramperson_id_WADApeople = "-1";
if (isset($_GET['person_id'])) {
$Paramperson_id_WADApeople = (get_magic_quotes_gpc()) ? $_GET['person_id'] : addslashes($_GET['person_id']);
}
mysql_select_db($database_connElite, $connElite);
$query_WADApeople = sprintf("SELECT person_id, person_cat_id, salutation_id, firstname, lastname, address, city, postcode, mobile, email, telephone, fax, username, password, password_hint, newsletter_id, user_level FROM people WHERE person_id = %s", GetSQLValueString($Paramperson_id_WADApeople, "int"));
$WADApeople = mysql_query($query_WADApeople, $connElite) or die(mysql_error());
$row_WADApeople = mysql_fetch_assoc($WADApeople);
$totalRows_WADApeople = mysql_num_rows($WADApeople);?>

Sign in to reply to this post

Eric Mittman

These problems look like they may have to do with the way that you are using the query variable in the sql. If it is just that the underscore is causing problems you should try using a variable that does not rely on an underscore, inner cased variable names should work for you without problems. Run a test with the names of the variables defined without an underscore in them to see if you have the same problem. If you do then it would indicate that the problem is not with the underscores but something else. Please post back and let us know what you discover.

Sign in to reply to this post

jenkolaka19379118

Hi Eric

  These problems look like they may have to do with the way that you are using the query variable in the sql. If it is just that the underscore is causing problems you should try using a variable that does not rely on an underscore, inner cased variable names should work for you without problems. Run a test with the names of the variables defined without an underscore in them to see if you have the same problem. If you do then it would indicate that the problem is not with the underscores but something else. Please post back and let us know what you discover.  



What is the query variable? Is that the table names and columns?

I have no idea how to understand the code I have just pasted, I general use the dreamweaver recordset user interface. I'm not sure how to change the code or even to know which part of the code is incorrect

  <?php
$Paramperson_id_WADApeople = "-1";
if (isset($_GET['person_id'])) {
$Paramperson_id_WADApeople = (get_magic_quotes_gpc()) ? $_GET['person_id'] : addslashes($_GET['person_id']);
}
mysql_select_db($database_connElite, $connElite);
$query_WADApeople = sprintf("SELECT person_id, person_cat_id, salutation_id, firstname, lastname, address, city, postcode, mobile, email, telephone, fax, username, password, password_hint, newsletter_id, user_level FROM people WHERE person_id = %s", GetSQLValueString($Paramperson_id_WADApeople, "int"));
$WADApeople = mysql_query($query_WADApeople, $connElite) or die(mysql_error());
$row_WADApeople = mysql_fetch_assoc($WADApeople);
$totalRows_WADApeople = mysql_num_rows($WADApeople);?>  



my table name is people
the primary key is person_id

Many Thanks

Sign in to reply to this post

jenkolaka19379118

Nearly There

Ok I changed all the the id fields in my whole database

e.g.

person_id to personID

and this appears to have fixed the sql Param errors.

However I am still having the following issue.

1. My update_page does not redirect to the detail page as specified.

2. My insert_page does not redirect to the results page. the page just refreshes after insert.

Do I need to check the checkbox "pass original query string" in the insert record behaviour for the pages to redirect?

code snippet for update page

  <?php
// WA Application Builder Insert
if (isset($_POST["Insert_x"])) // Trigger
{
$WA_connection = $connElite;
$WA_table = "companies";
$WA_sessionName = "WADA_Insert_companies";
$WA_redirectURL = "admin/companies_Detail.php";
$WA_keepQueryString = false;
$WA_indexField = "companyID";
$WA_fieldNamesStr = "company_name|company_address|company_city|company_postcode|company_telephone|company_email|company_fax|company_contact_firstname|company_contact_lastname|company_mobile|salutationID|company_category|company_information";
$WA_fieldValuesStr = "".((isset($_POST["company_name"]))?$_POST["company_name"]:"") ."" . "|" . "".((isset($_POST["company_address"]))?$_POST["company_address"]:"") ."" . "|" . "".((isset($_POST["company_city"]))?$_POST["company_city"]:"") ."" . "|" . "".((isset($_POST["company_postcode"]))?$_POST["company_postcode"]:"") ."" . "|" . "".((isset($_POST["company_telephone"]))?$_POST["company_telephone"]:"") ."" . "|" . "".((isset($_POST["company_email"]))?$_POST["company_email"]:"") ."" . "|" . "".((isset($_POST["company_fax"]))?$_POST["company_fax"]:"") ."" . "|" . "".((isset($_POST["company_contact_firstname"]))?$_POST["company_contact_firstname"]:"") ."" . "|" . "".((isset($_POST["company_contact_lastname"]))?$_POST["company_contact_lastname"]:"") ."" . "|" . "".((isset($_POST["company_mobile"]))?$_POST["company_mobile"]:"") ."" . "|" . "".((isset($_POST["salutationID"]))?$_POST["salutationID"]:"") ."" . "|" . "".((isset($_POST["company_category"]))?$_POST["company_category"]:"") ."" . "|" . "".((isset($_POST["company_information"]))?$_POST["company_information"]:"") ."";
$WA_columnTypesStr = "',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|',none,''|none,none,NULL|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_connElite;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$insertParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WA_Sql = "INSERT INTO `" . $WA_table . "` (" . $insertParamsObj->WA_tableValues . ") VALUES (" . $insertParamsObj->WA_dbValues . ")";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
$_SESSION[$WA_sessionName] = mysql_insert_id();
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>  



I manually prepended admin/ in the redirect code because my pages are in the this subdirectory. This did not help.

$WA_redirectURL = "admin/companies_Detail.php";

I even tried putting the abousolute url of the site, as I am testing directly on my remote server, but this didnt work either. I am completely lost?

Sign in to reply to this post

Eric Mittman

The updates to the sql parameters that I was referring to are the ones listed in the screen shots that office originally posted. Inside of the recordset you will have SQL variables listed as the parameters. It is these variable names that should not contain an underscore. So the update should not mean that you change the db but rather the names of these SQL variables inside of the recordset server behavior.

As for the redirecting have you been able to confirm that the update and insert are occurring? If they are occurring correctly then it is probably just a code order issue or something like that. Please post back with this info and also a copy of the insert and update pages in a zip file. I can take a look to help determine why the redirect is not happening.

Sign in to reply to this post

jenkolaka19379118

Hi Eric,

Thanks for your devotion.

The insert and updates pages work fine, however the only issue is that the pages do not redirect. When I test another site using my local testing server WAMP it redirects fine. I am using my remote server for this site and links are set relative to the site.

I am posting the code for the pages

Thanks in advance

Attached Files
redirectProblems.zip
Sign in to reply to this post

Eric Mittman

It seems like the pages should be redirecting based on the code that I can see in them. If the insert and updates are occurring correctly the code for the redirect should execute and take you to the details page.

It may be worth trying to add in an exit after the header. It is not very common but I have seen before where not having this in place after the header caused the location not to be updated.

The line of code appears near line 83 on the insert page and near line 101 on the update page. Here is what you should update it to:

php:
header("Location: ".$WA_redirectURL);

exit;



Please give this a try and let us know how it works for you.

Sign in to reply to this post

jenkolaka19379118

Still np Joy

Hi Eric,

I added the exit; code but after insert and update the page now just goes blank.

I tried a suggestion from Jimmy to add

  die($WA_redirectURL);  



but when i click update/ insert it still remains on the page, but instead of a blank page I get

  companies_Detail.php?companyID=5  



just this line on the blank update and insert page. However my database is still being updated so I am sure the issue is just with redirect there are no other problems with the page.

Could this have something to do with my hosting company or the ftp server, becuase I have never had this problem before testing other sites locally. this is the first time I am trying to do it remotely and have come up with this problem. Could it also have something to do with my site definition. I have assigned my remote server for remote information and as my testing server. I also checked the radio button, test locally and upload to remote server.

Sign in to reply to this post
loading

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