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

rating

Page Reload issue

Thread began 1/08/2014 6:45 pm by hbibizadeh396670 | Last modified 1/09/2014 12:56 pm by Jason Byrnes | 250 views | 5 replies |

hbibizadeh396670

Page Reload issue

I have a simple comment system on my page using the data assist insert.

The issue is that when the comment is posted, the comment will not appear until the page is refreshed.

When the page reloads it posts the comment 2 times for some reason

I have tried to play with settings, but the product wont seem to apply the code and nothing changes even if I direct the page to another.. I just reloads the same page..

Please let me know if i haven't explained my issue

Thanks

Sign in to reply to this post

Jason ByrnesWebAssist

move the upload and update code at lines 323 - 362

<?php
WA_DFP_SetupDownloadStatusStruct("WA_DownloadResult1");
if(isset($_POST["DownloadFileButton"]) || isset($_POST["DownloadFileButton_x"])){
WA_DFP_DownloadFile("WA_DownloadResult1", "../Forum-SharedFiles/", "".$row_Post['ShareFile'] ."", "[FileName]", false, false, false, "", "", "", "");
}
?>
<?php require_once("webassist/email/mail_php.php"); ?>
<?php require_once("webassist/email/mailformatting_php.php"); ?>
<?php
// WA DataAssist Insert
if (isset($_POST["CommentButton"]) || isset($_POST["CommentButton_x"])) // Trigger
{
$WA_connection = $Connection;
$WA_table = "siteezy_comments";
$WA_sessionName = "LatestComment";
$WA_redirectURL = "Post.php";
if (function_exists("rel2abs")) $WA_redirectURL = $WA_redirectURL?rel2abs($WA_redirectURL,dirname(__FILE__)):"";
$WA_keepQueryString = true;
$WA_fieldNamesStr = "MessageID|UserEmail|UserName|Comment";
$WA_fieldValuesStr = "".$row_Post['MessageID'] ."" . $WA_AB_Split . "".$row_User['UserEmail'] ."" . $WA_AB_Split . "".$row_User['UserFirstName'] ." ".$row_User['UserLastName'] ."" . $WA_AB_Split . "".((isset($_POST["Comment"]))?$_POST["Comment"]:"") ."";
$WA_columnTypesStr = "none,none,NULL|',none,''|',none,''|',none,''";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode($WA_AB_Split, $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_connectionDB = $database_Connection;
mysql_select_db($WA_connectionDB, $WA_connection);
@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($WA_connection);
if ($WA_redirectURL != "") {
$WA_redirectURL = str_replace("[Insert_ID]",$_SESSION[$WA_sessionName],$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);
}
}
?>

to 219 so it is before the recordset code.

Sign in to reply to this post

hbibizadeh396670

Thank you for the reply.

However, I moved the code (Please see file), but now the comments dont post at all..

Not Sure what is going on on the page?

Sign in to reply to this post

Jason ByrnesWebAssist

in the upload and the update behavior, you are using a few fields from the recordsets on the page.

instead, create hidden fields, bind the hidden the recordset values, and in the upload and update behaviors use the hidden field bindings instead of the recordset bindings.

Hers a basic description of what was going wrong:
First the code order was such that the Recordset was cerated, before the data in the database was updated. SAo the recordset would contain the original data.

to make it so the recordset can contain the updated information, the update needs to occur before the recordset is created.

the problem with that, is that the recordset doesn't exist while the update is occurring, but you are trying to use data from it in the update. this is causing the update to fail.

Sign in to reply to this post

hbibizadeh396670

Fantastic.. yes that fixed it... thanks again

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