Jump to content

Register triggers


amwd07

Recommended Posts

I really hope someone can help answer this question, I have tried everything and can't get this to work correctly.

 

I have a ratings system working I now need to allow visitors to comment on each rating

for example I have 6 ratings on the page and a sliding panel for each to post comment

now this works fine until you submit a comment, the problem is the comment is inserted 6 times

 

the reason for this is KT_Insert1 my submit button

so what seems to be happening is all the forms are inserting, the submit button has to be different for each one KT_Insert<?php echo $row_rs3['rating_id']?>

 

Now here comes the main problem Registertrigger won't allow this variable but insert will?

 

maybe this can't be done with dreamweaver developer toolbox, if this is the case can someone please provide me with a simular altenative?

 

// Make an insert transaction instance
$ins_restaurant_comments = new tNG_insert($conn_connDW);
$tNGs->addTransaction($ins_restaurant_comments);
// Register triggers
$ins_restaurant_comments->registerTrigger("STARTER", "Trigger_Default_Starter", 1, "POST", "KT_Insert{rs3.rating_id}");
$ins_restaurant_comments->registerTrigger("BEFORE", "Trigger_Default_FormValidation", 10, $formValidation);
// Add columns
$ins_restaurant_comments->setTable("restaurant_comments");
$ins_restaurant_comments->addColumn("name", "STRING_TYPE", "POST", "name");
$ins_restaurant_comments->addColumn("rating_id", "NUMERIC_TYPE", "VALUE", "{rs3.rating_id}");
$ins_restaurant_comments->addColumn("message", "STRING_TYPE", "POST", "message");
$ins_restaurant_comments->addColumn("created", "DATE_TYPE", "POST", "created", "{NOW_DT}");
$ins_restaurant_comments->addColumn("onhold", "NUMERIC_TYPE", "POST", "onhold", "1");
$ins_restaurant_comments->setPrimaryKey("comment_id", "NUMERIC_TYPE");

Link to comment
https://forums.phpfreaks.com/topic/79912-register-triggers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.