Need help writing an update / insert with linked tables

I am new to ColdFusion. I am learning to write querys and creates a small application to collect information from visitors to my web site. (It's also a good way for me to learn this language) I'm having a problem and it is not only the way to use an update / insert with related tables. I don't know if I'm still gather the appropriate variables to compare them to existing DB records until his execution is the update or insert some querys. Can someone help me, show me how can I update / insert related tables and maybe tell me if I create the varibales good to the compairison? This is my code, I commented out.

<! - creating a variable to compare with the db table - >
< cfset userIP = ('#CGI.) REMOTE_ADDR #') >

<! - run the query and compare the cfset cell remote_addr - >
< name cfquery = 'userTracking' datasource = "" #APPLICATION.dataSource # "dbtype ="ODBC">"
SELECT REMOTE_ADDR
Of user_track
WHERE REMOTE_ADDR = #userIP #.
< / cfquery >

<!-if the record exists, then run this update-->
< cfif userTracking EQ userIP >
< cfquery datasource = "#APPLICATION.dataSource #" >
UPDATED user_track, trackDetail
SET user_track. REMOTE_ADDR = < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">.
user_track. Browser = < cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
user_track.visits = visits + 1,
trackDetail.date = < cfqueryparam value = "#Now ()" # "cfsqltype ="CF_SQL_TIMESTAMP">,"
trackDetail.path = < cfqueryparam value = "#Trim (PATH_INFO)" # "cfsqltype ="CF_SQL_LONGVARCHAR">"
WHERE REMOTE_ADDR = < cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">
< / cfquery >
< cfelse >

<! - if it isn't, then insert a new record-->
< datasource = "" #APPLICATION.dataSource # cfquery "dbtype ="ODBC">"
INSERT INTO user_track, trackDetail
(user_track. REMOTE_ADDR, user_track.browser, user_track.visits, trackDetail.userID, trackDetail.date, trackDetail.path)
VALUES)
< cfqueryparam value = '#Trim (CGI.' ' REMOTE_ADDR) # "cfsqltype ="CF_SQL_VARCHAR">.
< Len (Trim (HTTP_USER_AGENT)) GT 1 cfif >
< cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
< / cfif >
visits + 1,
< cfqueryparam value = '#Trim (CGI.' "HTTP_USER_AGENT) #" cfsqltype = "CF_SQL_VARCHAR" >.
< cfqueryparam value = "" #user_track.userID # "cfsqltype ="CF_SQL_VARCHAR">,"
< cfqueryparam value = "#Now ()" # "cfsqltype ="CF_SQL_TIMESTAMP">,"
< cfqueryparam value = "#Trim (PATH_INFO)" # "cfsqltype ="CF_SQL_LONGVARCHAR">"
)
< / cfquery >
< / cfif >


I'm close on this? This throws any errors, but it is not no longer works. It is so obviously wrong. I get a cfdump the end of my query of compairison, but once it hits the stated case, it is lost.

Thanks for your time no matter who.

Newbie

You must define the variable before you can use it.  You try to use it on line 1 of your model.

Tags: ColdFusion

Similar Questions

  • Need help to reactivate Lightroom 5 with my old serial number and the number TAN.  I got a license for Lightroom 5 when I bought my Leica delux 4 in 2012.

    I got a license for Lightroom 5 when I bought my Leica delux 4 in 2012. It worked great, but after that I put an old hard drive on my PC (for 30 minutes - then I removed again) to get some information of this former, Lightroom now license application or try it for 30 days.

    I have not installed Lightroom on a new hard drive. He is always on the same hard disk. How can I now have my Lightroom to run again using my serial number and TAN? Need help to reactivate my old serial number and the number TAN.

    I use win 7.

    Duplicate thread: need help to reactivate Lightroom 5 with my old serial number and the number TAN.  I got a license for Lightroom 5 when I bought my Leica delux 4 in 2012.

  • Need help to solve the problem with the margin at the bottom of the converted pdf file.

    Need help to solve the problem with the margin of the converted CEO down. What caused the change in format?

    Hi jerrio1949,

    There is no way to change the margin, you settle back into your original file & then convert to PDF format.

    Kind regards
    Nicos

  • Need help to open two images with the same file with different exposures on the screen at the same time in the Photoshop creative cloud (in previous versions we could open two images of the same nef (raw) file and then combine them on the screen with the

    Need help to open two images with the same file with different exposures on the screen at the same time in the Photoshop creative cloud (in previous versions we could open two images of the same nef (raw) file and then combine them on the screen with the move tool. They have become a composite of two layers which could be developed further with the mask tool.

    Hello

    Please go to the preferences > workspace and uncheck the option 'open the document in the tabs '.

    Now you can click on file and choose file > open and open the two images in two different windows which can be arranged side by side.

    Thank you

  • I need help. I updated Adobe cc and now my photoshop does not work. Here is the error message:

    ' I need help. I updated Adobe cc and now my photoshop does not work. Here is the error message:


    Problem event name: APPCRASH

    Application name: Photoshop.exe

    Application version: 16.0.0.88

    Application timestamp: 55681d 39

    The default module name: StackHash_76b2

    The default module version: 0.0.0.0

    The default module timestamp: 00000000

    Exception code: c0000005

    Exception offset: 0000000000000006

    The system version: 6.1.7601.2.1.0.768.3

    Locale identifier: 3084

    Information extra No. 1: 76 b 2

    Information extra No. 2: 76b2e5a7b24373bbe6f47563f13e47b1

    Information extra No. 3: 51ff

    Information extra No. 4: 51ff68a42cf4d2164e10e22e1f794f34


    Hi Oscar,.

    Please see the thread below:

    Photoshop CC 2015 crashing?

    You can also check: 2015 release of Photoshop CC: FAQ

    Kind regards

    Sheena

  • Need help to understand political static with Nat No.

    Hi all

    I have a Pix 515e with 6 interfaces. 5 interfaces are considered as internal that we don't want any translation NAT occur between them. We want only NAT between the 5 and the external interface.

    I created a No_Nat ACL successfully to not manage any portion of nat.

    What I have trouble understanding is the static command to allow traffic between higher levels to lower levels and vice versa.

    I understand the

    public static inside_address outside_address (indoor, outdoor)

    for the part of NAT translation.

    What I do not understand, this is when the inside address and address outside are the same, what order are going. For example, my inner interface (192.168.1.0/24) (sec100) is where the live servers, and I have another interface named accounting (192.168.2.0/24) (sec75).

    If I don't want no nat occurs between these two, I have the following

    No_Nat of the 192.168.1.0/24 192.168.2.0/24 ip access list permit

    No_Nat of the 192.168.1.0/24 192.168.2.0/24 ip access list permit

    NAT (inside) 0-list of access No_Nat

    NAT (accounting) 0-list of access No_Nat

    Now how can I enter the static command?

    Maybe

    static (inside, accounting) 192.168.1.0 192.168.1.0 netmask 255.255.255.0

    or

    static (inside, accounting) 192.168.2.0 192.168.2.0 netmask 255.255.255.0

    or

    static (accounting, inside) 192.168.1.0 192.168.1.0 netmask 255.255.255.0

    or

    static (accounting, inside) 192.168.2.0 192.168.2.0 netmask 255.255.255.0

    I do not understand the prescription for it and why it would be used one verses the other way. Is the security level determines the order? Do I need two static command, one for each direction?

    Thank you

    Denny

    Hello denny

    static can be defined in any way... its only traffic that determines what it... for example, if accounting dmz is access to any server on your inside interface, you normally want the accounting servers see the original on its public IP server inside... so, you will end up as static

    static (inside, accounting) 192.168.1.0 192.168.1.0 netmask 255.255.255.0

    only the above static command is sufficient to establish connectivity between inside and dmz accounting. u don't need 2 static on any sense...

    Similarly, if you want to inside users to access a server on the dmz accounting, you can write a static type

    static (accounting, inside) 192.168.2.0 192.168.2.0 netmask 255.255.255.0

    hope you understand. Let us know if you need help... but normally a statement nat 0 is more than enough for the inside / dmz communication

    Kind regards

    REDA

  • need help to install the printer with cd rom

    Hello, I need help to install a 3310 pphotosmart printer all in one. I don't have the cd ROM any help will be greatly appreicated.

    Thank you

    Hello

    You can download the installer for your printer using the link below.

    http://h10025.www1.HP.com/ewfrf/wc/product?product=439491&LC=en&cc=us&DLC=en&task=&lang=en&cc=us

    Choose "Software and Driver Downloads", select your operating system, open "driver-product Installation Software" and then choose the option download Installer "Full Feature".

    Kind regards

    DP - K

  • Need help as soon as POSSIBLE with RAM Preview

    Hey guys I need help with my RAM Preview and how to get it back on the default setting. I don't know what happened, but now my RAM Preview is divided on two screens. I tried literally everything to solve this problem and came to nothing. Nothing on google as well. Help, please! I need to get there soon! Here's what happens: 2016-09 - 03.png - Google Drive

    This is your equal to 2 times and not the RAM Preview Composition Panel (in fact it is seen now and not the RAM Preview... you can call him Mr. Preview if you want to get fancy). knowing how to describe your problem lies at halfway to a solution

    DON'T PANIC!

    Set it to 1 view and you'll be fine!

    These views are used for 3D to show the different perspectives and views spelling of a 3D scene. When they have no use in 2D. If you clicked on the option to display 2 views or more they will appear unless you change it back manually. even when you reset your workspace, they will appear - so I understand why this can be confusing.

    more about it here: https://helpx.adobe.com/after-effects/using/modifying-using-views.html...

  • I need help creating a vector mask with an adjustable edge or fade, can anyone help?

    I need help creating a vector with an adjustable edge mask or disappear so that I can surround a hand drawn - isolate the background so that I can black out around the hand, the hand a hair above, so I can not just pen tool, can anyone help?

    hand4.jpg

    hand.jpg

    I recommend starting with a layer mask based on the green channel, edition that with the curves to get a decent contrast and then paint in the areas needed.

  • Best practice help to spend again vCenter with linked Clones

    Hello everyone

    I searched for days, but couldn't find a way clear of hover over our view 5.2 installation of a new vCenter.  The equipment was aging, and we decided to upgrade and move to 5.5.

    We have rebuilt and forwarded via our guests not VDI to the new vCenter 5.5 environment. I found a few documents, but nothing that tells us if it can be done actually.

    We tried to go in the service of the composer initially to the new instance of vCenter and maintenance, we do the DB on the old Victoria Cross, if it worked I émigrerait the DB above the new Victoria Cross

    We first tried these steps however VMware Documentation Library after removing the old VC service composer and installed on VC New (with ODBC connections mapped to the old VC) it wouldn't work.  We were moving to the VC 5.1 leaving guests ESXi running VDI attached to 5.1

    Then I did more research and discovered the related clones are all related to the database of the old VC and moving them is not possible per this KB KB VMware: workstations managed by moving between servers view vCenter is not supported

    I saw an article here that suggested dumping a bunch of DB and rebuild the new VC with the same name and IP address, but I can't do so because the new instance is already upwards and on a new host name / IP migrate view VCenter (with linked Clones) to new hardware

    I also found this where someone is in the same boat and suggested to recreate pools.  The discussion is not in the details so I wonder if someone can clarify this: migration View Composer and vCenter

    I have about 20 people on VDI in a combination of clones using 3 connected pools and personal drives.  Given that all the info from linked clone was linked to the former base of VC, it doesn't seem wise to move it to the wire.  This would be possible: I still have the base image with all the snapshots for each pool.

    • Persistent backup drives
    • Note the configuration of each pool
    • Disable the commissioning
    • Create DB on VC 55 composer vacuum
    • Create the ODBC connection for composer on VC 55
    • **
    • Do more ESXi hosts to 55 VC
    • Remove existing VMs (will be not able to connect to them at this point anyway)
    • Remove the old VC entry admin view / delete existing pools
    • Install the composer on 55, and then tap new ODBC
    • Create new instance vCenter in Admin 55-pointing mode
    • Recreate pools
    • Import and attach persistent disks (http://pubs.vmware.com/view-50/index.jsp?topic=/com.vmware.view.administration.doc/GUID-BDFCCEC8-682F-4421-8810-06108CBE8D20.html)
    • Recreate events empty DB on 55
    • Reconfigure the parameter DB events in Admin mode

    Any help would be greatly appreciated as I can't find an exact way to do

    Well, I'm pleased to say it worked! I had a few problems by removing existing pools. View repeated deletion but nothing happened. In the end I had to use ADSIedit to connect to the server to manually remove all the old discs VM and pool

    After the installation of the composer on the VC 5.5, I was able to create a login in admin mode and then start to re - create the pools.

    We were able to successfully reattach each disc persistent owners planned.  Did some spot checks and desktop users, bookmarks etc. all worked

    It is a tedious process, but it does not work. I hope that VMware can create an article for it.  God knows that I searched for days, I had to read a lot of things just for this plan.

  • need help writing records in tables multipul delete trigger

    I am trying to write a trigger that might help me to delete the record from 3 different tables

    Let's say I table a, b and c

    I have one is trying to write a trigger that might help me to delete the record of table has and c.


    Drop trigger az_zzz_trigger;
    create trigger az_zzz_trigger
    before INSERT or update or DELETE ON az_employ
    FOR EACH LINE

    BEGIN
    IF REMOVE then
    remove from za_payroll
    remove from az_salary_audit
    end if;
    end;
    /


    during the execution of this trigger is delete all the data in the za_payroll table.

    What should I do so that only the record that I delete az_employ is removed from az_payroll and az_salary_audit

    872959 wrote:
    I am trying to write a trigger that might help me to delete the record from 3 different tables

    Let's say I table a, b and c

    I have one is trying to write a trigger that might help me to delete the record of table has and c.

    Drop trigger az_zzz_trigger;
    create trigger az_zzz_trigger
    before INSERT or update or DELETE ON az_employ
    FOR EACH LINE

    BEGIN
    IF REMOVE then
    remove from za_payroll
    remove from az_salary_audit
    end if;
    end;
    /

    during the execution of this trigger is delete all the data in the za_payroll table.

    What should I do so that only the record that I delete az_employ is removed from az_payroll and az_salary_audit

    use the appropriate WHERE clause

  • Need help to restore Iphone recycled with no password

    Hello, I received a recycled locked Iphone no password need help. Downloaded Itunes followed instructions nothing and I have no company of cells still need help. J.

    You must use a SIM card to activate the phone

    IF the phone is locked - so it must be a carrier card

    IF the carrier unlocked - any SIM card will do

    There is no need for a new SIM card

  • Need help to create a scrollbar in HTML table

    Hello dreamweavers!

    I need help here please...

    I need to create a table with three columns... or a webpage... that has the ability to scroll when things are added.


    This is a music site and page Web will be a list - a database of all sorts - of each title artist and album. If there are say, 200 titles in the catalog, then I need to list them all on one page and in 3 columns towards the bottom of the page. What I did using a table in HTML in Dreamweaver. The problem is each title on the table is static and when adding in a new title in the catalog, ALL securities will have to be moved manually. So, I need to create a table where when I add another title (they will be alphabetical) say to am' for example, then all of the other titles will be automatically moves along a (somewhat as in a Word document by adding a new line). Everything else is automatically shifted. I don't know if this is still possible in Dreamweaver?

    I hope that I have explained this correctly. It's quite a strange problem, and as such, I have been unable to find anything on this forum or google search.
    If anyone can help that would be most excellent! I'd be happy.

    Questions - if you need further information please ask

    I use Dreamweaver CS5.5 Version 11.5 Build 5315

    I have a Macbook Pro with Snow Leopard if that's at all relevant.

    My site is on Wordpress with the theme, Suffusion. I can link to it, if someone needs.

    Here is a picture of the table, as I did, to give an idea what it looks like:

    columns.jpg

    Thank you!

    P.I.G > /.

    big dreamers never sleep

    Mylenium was right. You must use a database for this server-side.

    Maintenance of static tables with this amount of data is going to be a logistical nightmare - not even worth considering.   Get an indexing plugin for WordPress.

    Nancy O.

  • Need a logic sql to insert from one table to another

    I have a table ( TABLEA ) as follows:

    type_id level

    -------------

    1       7

    2       4

    I would like to insert above values in another table ( TABLEB ) through DML so it looks like so:

    seq_id type_id name    order level

    -----------------------------------

    1     1       display  1     7

    2     1       header   2    

    3     1       detail   3    

    4     2       display  1     4

    5          2          header    2

    6         2           detail      3   

    Looks like a very complex sql is necessary, for which I have no knowledge of :-).

    Hello

    97a5a09d-76e1-4fc7-8113-80b4705be7f4 wrote:

    I have a table ( TABLEA ) as follows:

    type_id level 
    -------------
    
    1       7 
    2       4 
    

    I would like to insert above values in another table ( TABLEB ) through DML so it looks like so:

    seq_id type_id name    order level 
    -----------------------------------
    
    1     1       display  1     7 
    2     1       header   2     
    3     1       detail   3
    4     2       display  1     4
    5          2          header    2
    6         2           detail      3    
    

    Looks like a very complex sql is necessary, for which I have no knowledge of :-).

    So, for each line in tablea, you want to INSERT 3 rows in tableb, is that at the time?

    One way to do that is to tablea to join of a table (or the result set) with 3 rows, like cntr below:

    INSERT INTO tableb (seq_id type_id, row_name, row_order, lvl)

    WITH cntr AS

    (

    SELECT LEVEL AS row_order

    OF the double

    CONNECT BY LEVEL<=>

    )

    SELECT ROW_NUMBER () OVER (ORDER BY a.type_id

    c.row_order

    ) - or sequence_name. NEXTVAL

    a.type_id

    Case c.row_order

    WHEN 1 THEN 'display '.

    WHEN 2 THEN 'head '.

    WHEN 3 THEN «details»

    END

    c.row_order

    Case c.row_order

    WHEN 1 THEN a.lvl

    END

    FROM tablea a

    CROSS JOIN cntr c

    ;

    If you would care to post CREATE TABLE and INSERT for your tables (as it exists before the UPDATE), then I could test this.

    NAME is not a very good column name, but it is nowhere near as bad as the ORDER or LEVEL.  I called ROW_NAME, ROW_ORDER and LVL columns instead.

  • Need help in generating XML data to a table in XML format

    Hi all

    I need help to generate an xml file using the data below.

    The table name is T_Data have 4 columns as shown below with data.

    Neighbourhood region Division
    ---------- ----------------------- ----------- -----------
    Northwest Northern California San Jose SJStore1
    Northwest Northern California San Jose SJStore2
    Northwest North of California to the North of THE LAStore1
    Northwest North of California to the North of THE LAStore2
    Northwest North of California to the North of THE LAStore3

    I want to generate an XML file using SQL/XML functions and the XML file should look like as below.

    <>region
    < name of region > Northwest < / name of the region >
    < Division >
    Northern California < division name > < / Division name >
    District of <>
    SanJose < district name > < / District name >
    <>store
    < store name > SJStore1 < / name >
    < store name > SJStore2 < / name >
    < / store >
    < / district >
    < / division >
    < / region >

    Very much appreciate your help here.

    Thank you.

    I tried to group the lines, but they did not then provide a correct output.

    To unflatten dataset, we can use nested GROUP-BY subqueries.

    The following will produce a line by region.
    If all regions must be grouped in a single root element (does not so appear according to the directives of the sample), we just add an another XMLAgg.

    SQL> with sample_data as
      2  (
      3    select 'Northwest' reg, 'Northern California' div, 'San Jose' district, 'SJStore1' st from dual union all
      4    select 'Northwest' reg, 'Northern California' div, 'San Jose' district, 'SJStore2' st from dual union all
      5    select 'Northwest' reg, 'Northern California' div, 'North LA' district, 'LAStore1' st from dual union all
      6    select 'Northwest' reg, 'Northern California' div, 'North LA' district, 'LAStore2' st from dual union all
      7    select 'Northwest' reg, 'Northern California' div, 'North LA' district, 'LAStore3' st from dual
      8  )
      9  select reg
     10       , xmlserialize(document
     11           xmlelement("Region"
     12           , xmlelement("RegionName", reg)
     13           , xmlagg( division_xml )
     14           )
     15           indent -- for display purpose
     16         ) as region_xml
     17  from (
     18      select reg
     19           , xmlelement("Division"
     20             , xmlelement("DivisionName", div)
     21             , xmlagg( district_xml )
     22             ) as division_xml
     23      from (
     24          select reg
     25               , div
     26               , xmlelement("District"
     27                 , xmlelement("DistrictName", district)
     28                 , xmlelement("Store"
     29                   , xmlagg(
     30                       xmlelement("StoreName", st)
     31                     )
     32                   )
     33                 ) as district_xml
     34          from sample_data
     35          group by reg
     36                 , div
     37                 , district
     38      )
     39      group by reg, div
     40  )
     41  group by reg ;
    
    REG       REGION_XML
    --------- --------------------------------------------------------------------------------
    Northwest 
                Northwest
                
                  Northern California
                  
                    North LA
                    
                      LAStore1
                      LAStore3
                      LAStore2
                    
                  
                  
                    San Jose
                    
                      SJStore1
                      SJStore2
                    
                  
                
              
     
    

Maybe you are looking for

  • Can I connect an iPhone 6s

    Can I connect an iPhone 6s to push mobile if it is sim free

  • How do I change the destination file download to open it in the application?

    When downloading files from my Bank in MS Money, the default is to open directly in MS Money. Recently, I needed to save the file on the desktop but faile to uncheck "do this for all files in the future." Now I can not download files directly into MS

  • Duel monitor

    I have just installed bootcamp on my computer (end 2013 Mac Pro) and a staff nine MBP (15 "with a dedicated graphics card). Both computers work fine with multiple monitors during execution of OS X, but as soon as I swap Windows 10, they will work onl

  • DeskJet 2130:2130 impossible to configure the device

    I am trying to install this printer with the HP Easy Start, but having no luck. When I select the printer that I want to use, it is said that I need to make sure that my computer is connected to the Internet. My computer is connected to the Internet,

  • Receive 80070026 error during update KB975496 and KB980846

    Hi all... I'm running Windows 7 x 64 bit computer and when you run Windows Update I see two critical / important updates are necessary. KB975496 and KB980846. Whenever I run updates, I get error Code 80070026. I can't find that everything about my pr