Jump to content

custom trigger using dreamwever developer toolbox


peter.t

Recommended Posts

Hello,

 

I've got an insert/update form (created using dreamweaver developer toolbox).  That part was easy, however I'm stuck on this particular validation.

 

When I click the Insert button, here's what I need to have happen:

...check the db table the info is being entered into (dlog_test) to see if any records contain the same time (time_dal) and date (date_dal).  If there are records with the same time and date and the number of rows of records = 3, then I need an error message to appear and say "This timeslot is already filled."

 

I'm just not having any success with what I've tried so far.

I'm hoping this code below is close...I have this code in my Custom Trigger.

 

$query = "SELECT COUNT(*) AS NUMBER FROM dlog_test WHERE dlog_test.time_dal = ".KT_escapeForSql($tNG->getColumnValue("time_dal"),$tNG->getColumnType("time_dal"))." AND dlog_test.date_dal = ".KT_escapeForSql($tNG->getColumnValue("date_dal"),$tNG->getColumnType("date_dal"));

$result = $row_rsCount == 2;

if(!$result) {

$error = new tNG_error("Timeslot is filled!",array(),array());

return $error;

}

 

Any chance I'm on the right track?

Thanks!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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