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

Conditional Redirect in Update Statement

Thread began 2/04/2011 11:30 am by bjgarner241692 | Last modified 2/04/2011 2:34 pm by bjgarner241692 | 1105 views | 8 replies


Conditional Redirect in Update Statement

I've borrowed from DataAssist in order to update a customer record.
In DA, the Redirect URL would be the detail page of the record. I changed that to go to a page with a form and that worked just fine, but now I am trying to fine tune it because depending on the visit number, the client will get a different form.

Once I put in the conditional statement though, it seems to ignore it and instead defaults to the form appropriate for visit 1, even though my visitcount is being properly updated.

Here is my Update code.


// WA Application Builder Update
if (($_SERVER["REQUEST_METHOD"] == "POST") && (isset($_SERVER["HTTP_REFERER"]) && strpos(urldecode($_SERVER["HTTP_REFERER"]), urldecode($_SERVER["SERVER_NAME"].$_SERVER["PHP_SELF"])) > 0) && isset($_POST)) // Trigger
$WA_connection $conn;
$WA_table "clienttable";
  if (
$row_count['visitcount'] <= 1) { // Adv Conditional Region
$WA_redirectURL "https://____/index.php?option=com_content&view=category&layout=blog&id=10&Itemid=38";
// $row_count['visitcount'] <= 1
if ($row_count['visitcount'] >=2) { // Adv Conditional Region
$WA_redirectURL "https://_____/index.php?option=com_content&view=category&layout=blog&id=23&Itemid=60";
// $row_count['visitcount'] >=2
$WA_keepQueryString false;
$WA_indexField "eID";
$WA_fieldNamesStr "emailaddr|visitcount|username|fname|lname";
$WA_fieldValuesStr "".((isset($_POST["emailaddr"]))?$_POST["emailaddr"]:"")  ."" "|" "".((isset($_POST["visitcount"]))?$_POST["visitcount"]:"")  ."" "|" "".((isset($_POST["username"]))?$_POST["username"]:"")  ."" "|" "".((isset($_POST["fname"]))?$_POST["fname"]:"")  ."" "|" "".((isset($_POST["lname"]))?$_POST["lname"]:"")  ."";
$WA_columnTypesStr "',none,''|none,none,NULL|',none,''|',none,''|',none,''";
$WA_comparisonStr "=|=|=|=|=";
$WA_fieldNames explode("|"$WA_fieldNamesStr);
$WA_fieldValues explode("|"$WA_fieldValuesStr);
$WA_columns explode("|"$WA_columnTypesStr);
$WA_where_fieldValuesStr "".((isset($_POST["WADAUpdateRecordID"]))?$_POST["WADAUpdateRecordID"]:"")  ."";
$WA_where_columnTypesStr "none,none,NULL";
$WA_where_comparisonStr "=";
$WA_where_fieldNames explode("|"$WA_indexField);
$WA_where_fieldValues explode("|"$WA_where_fieldValuesStr);
$WA_where_columns explode("|"$WA_where_columnTypesStr);
$WA_where_comparisons explode("|"$WA_where_comparisonStr);
$WA_connectionDB $database_conn;
  if (!
session_id()) session_start();
$updateParamsObj WA_AB_generateInsertParams($WA_fieldNames$WA_columns$WA_fieldValues, -1);
$WhereObj WA_AB_generateWhereClause($WA_where_fieldNames$WA_where_columns$WA_where_fieldValues,  $WA_where_comparisons );
$WA_Sql "UPDATE `" $WA_table "` SET " $updateParamsObj->WA_setValues " WHERE " $WhereObj->sqlWhereClause "";
$MM_editCmd mysql_query($WA_Sql$WA_connection) or die(mysql_error());
  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 am sure it is just syntax, or ordering, but I am struggling. Any insight or assistance would be greatly appreciated.


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





Ease of use


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