Adobe Dreamweaver Forums



Last 10 THreads :         Please Help A Newb!!!! (Last Post : raynalyn - Replies : 0 - Views : 1 )           »          Update HELL for unsupported OS... (Last Post : WTF? - Replies : 0 - Views : 1 )           »          Cannot install Flash Player 10 (not-beta) (Last Post : Darren McNally - Adobe - Replies : 8 - Views : 9 )           »          Full screen flash projector reverts to windowed whenexiting screen saver (Last Post : rbolman - Replies : 0 - Views : 1 )           »          On hitTest go to next frame? Why doesn't this work? (Last Post : kglad - Replies : 1 - Views : 2 )           »          Contribue won't allow Images to be inserted (Last Post : RiderAlberta - Replies : 0 - Views : 1 )           »          This just sucks.... (Last Post : TC2112 - Replies : 11 - Views : 12 )           »          Update from array (Last Post : -==cfSearching==- - Replies : 3 - Views : 4 )           »          PHP Notice Problem (Last Post : UteFanJason - Replies : 7 - Views : 8 )           »          Limited Ammo (Last Post : kglad - Replies : 19 - Views : 20 )           »         


Home Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
User Info Statistics
Go Back   Adobe Dreamweaver Forums > Dreamweaver: Main > Dreamweaver Php Development
 
Tags: , ,

Reply
  #1 (permalink)  
Old 07-20-2008, 10:39 AM
Jan_Neuhoff@adobeforums.com
 
Posts: n/a
Diggs:
Default Custom Trigger Connection

Hello All.

How do I change the connection in a Custom Trigger?

I want to update a table in a second database.

Jan
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-20-2008, 10:48 PM
shane_mosier@adobeforums.com
 
Posts: n/a
Diggs:
Default Re: Custom Trigger Connection

Jan,

You would do something like this in the custom trigger:

$query = "UPDATE this_table SET this_field = '1'";

$update_result = $tNG>connection>execute($query);

if(!$update_result) {
$updateError = new tNG_error("Error Updating",array(),array());
return $updateError;
} else {
return NULL;
}

This is a basic example that spits out an error if the update is unsuccessful.

Look at Chapter 16 of the Adobe Dreamweaver Developer Toolbox Help pdf for more information regarding custom triggers. It gives some more examples.

Shane
Reply With Quote
  #3 (permalink)  
Old 07-21-2008, 05:46 AM
Jan_Neuhoff@adobeforums.com
 
Posts: n/a
Diggs:
Default Re: Custom Trigger Connection

Hello Shane.

I have a insert transaction using Connection_1 and a Custom trigger like your example.

But I want to update a second Table of a second Databsase using Connection_2.
Your example is using Connection_1. (The same connection as the Transaction)

Is it possible to use Connection_2 for the custom trigger?

Jan
Reply With Quote
  #4 (permalink)  
Old 07-21-2008, 03:56 PM
shane_mosier@adobeforums.com
 
Posts: n/a
Diggs:
Default Re: Custom Trigger Connection

Jan,

I'm pretty sure you can do this. You should be able to do something like this in the trigger:

mysql_select_db($database_Connection_2, $Connection_2);
$query_RecordsetUpdate = "UPDATE....";
$RecordsetUpdate = mysql_query($query_RecordsetUpdate, $Connection_2) or die(mysql_error());
$row_RecordsetUpdate = mysql_fetch_assoc($RecordsetUpdate);

$database_Connection_2 and $Connection_2 need to match the variable names located in your database connection file for Connection_2 located in the Connections folder of your site.

I have never had to connect to a separate database, but this should work.

Shane
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



© Camley Interactive (camley.info) 2008 - all logos and images are copywrite their respective owners.
Proud member of the Camley Interactive Network
All times are GMT. The time now is 12:24 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.
Inactive Reminders By Mished.co.uk