How to model in OWB if you have a subquery in your select statement? (11.2)

Which operator (is it the Table operator) to use if I have a subquery as part of my select statement? (The way I do it works, but is not elegant. What I do is create a table for the subquery and than join that with the other sources to point to my target.) But, would appreciate the best way with OWB's features.
Here is the entire SQL (including the subquery):
SELECT to_numbe (null), course_id
at.book, lp.NAME,
(select b.pricing from qp_pricing_attributes b
where b.list_id = ll.list_id and b.product = at.product) sign,
ll.operand AS price, lhb.comments
FROM
pricing_attribs at,
list_lines ll,
list_h lp,
list_b lhb
WHERE 1 = 1
and ll.list_line_id = atrib.list_line_id
AND ll.list_header_id = lp.list_header_id
AND lp.list_header_id = lhb.list_header_id
Thanks you.

Hi
Doesn't need to be a table in the target. Let's take a very simple example, let's say you wanted to do the following;
select ename,(select dname from dept d where d.deptno=e.deptno) from emp e
Then DEPT is your lookup table and EMP is your driving table.
1. Add EMP on to the canvas.
2. Add in lookup operator
3. Bind lookup to DEPT
4. Hit finish
5. Map EMP.DEPT to DEPT.INGRP1 (the lookup operator)
6. Edit lookup operator, on Lookup Conditions tab set DEPTNO for lookup column, and DEPTNO for input attribute
7. Lookup complete now
You can add in a target table operator and map from the source EMP table and the output attributes of the lookup operator. you can change step 4 to carry on through wizard and define lookup, but I have chosen to do 5, to automatically get the names and datatypes of the inputs. There are lot of other options now in 11gR2 in the lookup.
Hope this makes sense.
Cheers
David

Similar Messages

  • Add People button results in "You have labeled everyone in your selection"

    Hopefully there's a solution out there that I simply failed to find.
    I am using PSE11 20120830.r.32025
    When I click on the "Add People" button under the "People" tab in the Organizer, normally the program would show a dialog box, "Preparing files...", then show either faces it doesn't recognize for me to tag, or show a window with known faces on the left and potential matches on the right for my to verify.
    However, lately when I click on "Add People", it still shows the "Preparing files..." dialog, but then it brings up a windows saying "You have labeled everyone in your selection".
    This is obviously not true, since I can go through the majority of my pictures that do no have the faces tagged (most show the "Who is this?" box where the name would normally show.
    This happened to me before, and I started a brand new catalog to see if the old one had just gotten corrupted, but here I am again, stuck.
    Please help!

    Go to Edit >> Preferences >> Media-Analysis
    Make sure the box for people recognition is checked.
    Otherwise click the Media Tab and make sure you are showing all media. Then, without selecting any thumbnails, try again and leave Elenents to complete the indexing.

  • I cannot open a photo library from an external hard rive  I get a message that says: You have made changes to your iPhoto library using a newer version of iPhoto.  How do I access this library?

    I cannot open a photo library from an external hard rive  I get a message that says: You have made changes to your iPhoto library using a newer version of iPhoto.  How do I access this library?

    and
    and have you opened this library with any other computer?
    LN

  • How many max connections opened do you have?

    Hello!
    I've read so many answers to these questions that, i don't really know what is the correct one. So, i would like to know what do you have. Here they are:
    1- How many max connections per torrent do you have set up?
    2- How many max opened connections do you have in mldonkey (or similar)?
    Thanks!
    Last edited by dienadel (2007-03-08 08:25:36)

    AFAIK it's arround (total connections):
    - <5 for RTC
    - <100 for slow ADSL
    - <500 for medium ADSL
    - ~1000 for high-speed ADSL (and max on Windows lol) ; went up to over 1500, without positive change.
    I use rtorrent & have a limit of <100 connections per torrent (4 leechers max per torrent so they get something)

  • "You have included content in your post that is not permitted" when trying to post very positive feedback about Apple.

    So I spent 2 hours writing a huge post about how I love what Apple has done with the Audio/MIDI/Sound config tools in OSX. 
    I spent alot of time trying to be positive.  And i get to the end and click "Post" - this stops me and gives me the following vague message:
    "You have included content in your post that is not permitted."
    I am not sure what this means or why it appeared.  I used no negative content in my post, no cursing or trolling or anything... And i wouldn't try to troll or flame on these forums anyways.  I've posted some problems I've had, which were all addressed very quickly by the way.  And I've always said what I thought, but never just posted things to be negative.
    And then after my post is rejected, i tried again.  The discussion forums offered to restore my previous draft, but I clicked yes and nothing happened.  Then the entire Discussions site pretty much stopped functioning... I tried closing reopening Chrome.  I tried a completely new session in Chrome Incognito.  I tried using Safari.  None worked. 
    I was then offered a survey to take.  I clicked "yes", and nothing happened.  Then I looked at the Javascript Link for the survey and used the Chrome console to send the javascript anyways.  And then it said the survey was behind my browser (it wasn't) and there was an "X" button to close the yellow notification at the top of the page.  Then restarted my computer and it's finally working, but my post is still being rejected, which is ridiculous.
    Anyways, went through alot to say something positive.  That is the exact thing that gets to me though, it's the censorship.  Why am I not allowed to say something good?  Hopefully this one goes through...

    I don't believe I'm circumventing any DRM/Copyright.  I'm currently enrolled in a Harvard eDx Copyright Law class. As long as you are original and offer a minimum of creativity, you are eligable for a copyright, without any need for registration.  But that's besides the point.  I can see how it may have flagged the post though.
    Ultimately, what I was trying to do at the time is play music using software that I own and stream this in online video.  But the comment about streaming my personal music online is just an example of something awesome I can do with an Apple product.
    Thanks for the link to the feedback page though.  I'll go ahead and send it in.

  • Opening iphoto I get an error message that says "you can't open your current photo library using this version of iphoto.  You have made changes to your photo library using a newer version of iphoto.  Please quit and use the latest version of iphoto.

    Opening iphoto I get an error message that says "you can't open your current photo library using this version of iphoto.  You have made changes to your photo library using a newer version of iphoto.  Please quit and use the latest version of iphoto."  I wouldn't have a clue as to how to change to a new version of iphoto even if I wanted to. 

    If you don't have a backup you can resort to give this a try:
    Starting over from scratch with new library
    Start over with a new library and import the Originals (iPhoto 09 and earlier) or the Masters (iPhoto 11) folder from your original library as follows:
    1. Open the library package like this.
    2. Launch iPhoto with the Option key held down and, when asked, select the option to create a new library.
    3. Drag the subfolders of the Originals (iPhoto 09 and earlier) or the Masters (iPhoto 11) folder from the open iPhoto Library package into the open iPhoto window a few at a time.
    This will create a new library with the same Events (but not necessarily the same Event names) as the original library but will not keep the metadata, albums, books slideshows and other projects.
    Note:  your current library will be left untouched for further attempts at a fix if so desired.
    OT

  • I just reinstalled and this is the question that show "You have made changes to your photo library using a newer version of iPhoto. Do you want to quit and use the latest version of iPhoto, or do you want to create a new photo library?"  what do i do next

    I just reinstalled and this is the pop up that shows "You have made changes to your photo library using a newer version of iPhoto. Do you want to quit and use the latest version of iPhoto, or do you want to create a new photo library?"  what do i do next? it just keeps popping up and loading but only gives a quit button?

    Update it.
    How old is your Mac? If it's very recent you need to update via the App Store
    If you purchased at the App Store you need to update via the App Store
    Otherwise you update via Softare Update
    Regards
    TD

  • You have made changes to your photo library using a newer version of iPhoto. Do you want to quit and use the latest version of iPhoto, or do you want to create a new photo library?

    Long story short, I made a backup using TimeMachine of my iMac.  I got my MBA which was being repaired and i restored from backup.  Everything works fine, except for iPhoto which is not saying:
    "You have made changes to your photo library using a newer version of iPhoto. Do you want to quit and use the latest version of iPhoto, or do you want to create a new photo library?"
    I have OS X 10.7.2 and iPhoto 9.1.4.  I've tried:
    Repairing permissions
    Deleting iPhoto, installing agaian, and updating
    Repaired iPhoto Library (stays stuck at 98% when rebuilding database)
    I've also tried iPhoto Library manager which cannot even see the library
    Tried restoring from backup from iPhoto and it messed up library (I still had my backup)
    Quite frustrating - any ideas on how to get iPhoto back to life?

    Dunno why Software update was not displaying the latest version of iPhoto (9.2.1 as of January 27, 2012)...updating to this has fixed the issue

  • Hello! I am writing to inform you that about that you have a problem displaying your website in the browser.

    Hello! I am writing to inform you that about that you have a problem displaying your website in the browser.
    In Yandex browser. I decided to tell you, because the site is not displayed correctly. As in the screenshot.

    apart from the fact there's no way I could have answered your question confidently, I was also not able to supply my non-answer within your very tight time constraints.
    what happened? how'd you get on?

  • I try to open iphoto and it comes up with You have made changes to your photo library using a newer version of iPhoto. Please quit and use the latest version of iPhoto. I have downloaded photo manager and it's telling me to update but it wont update...

    I try to open iphoto and it comes up with You have made changes to your photo library using a newer version of iPhoto. Please quit and use the latest version of iPhoto. I have downloaded photo manager and it's telling me to update but it wont update...

    iPhoto is Apple's included program to manage your photo's and pictures.
    It receives updates over time with Software updates and new machine or iLife purchases.
    When iPhoto gets updated or a newer version is used, it may alter iPhoto support files, but newer iPhoto versions usually always compatible with older files which it then updates.
    If you used a newer iPhoto on your iPhoto support files, then they got altered to the newer format, older iPhoto versions can't read the older format.
    Somewhere along the line you somehow got a older version of iPhoto on your computer, you need to fine the newer version of iPhoto (not this photo manager, sounds like another program)
    Or somewhere along the line you used a newer iPhoto version (like on another Mac) and it altered the iPhoto support files on your older version of iPhoto.
    So the key here is to find the newest version of iPhoto and use that to access your iPhoto support files.
    If you didn't access your iPhoto support files from another Mac, then you should have the newer iPhoto version on your computer.
    Once you find it, and get it in the Dock, you should remove the older iPhoto version from your computer to prevent this from happening again.
    Lastly, if the newer version of iPhoto is somehow gone off your computer, you should be able to get a copy off the latest OS X install disk or iLife using a free program called Pacifist.
    http://www.charlessoft.com/
    Then you need to check for updates for iPhoto in the program itself, the current version is 9.1.2

  • I keep receiving this message "You can't open your current photo library using this version of iPhoto" You have made changes to your photo library using a newer version of iPhoto. Please quit and use the latest version of iPhoto."

    I keep getting this message. What do I do? You have made changes to your photo library using a newer version of iPhoto. Please quit and use the latest version of iPhoto.

    https://itunes.apple.com/ca/app/iphoto/id408981381?l=en&mt=12

  • No Adobe support for CC Team Members if you have installed Parallels on your Mac

    No Adobe support for CC Team Members if you have installed Parallels on your Mac
    First let me make it clear my iMac is running native OS X 10.8.5 and all Adobe Creative Cloud Apps are install on the iMac running natively in the OS X system environment. I only have Parallels Desktop 8 for Mac installed to run Microsoft Office software in Windows 7 when needed (because PowerPoint for Mac sucks big time compared to the PC version)… absolutely no Adobe CC Apps have been installed on the Parallels virtual PC environment.
    I have been having problems with Creative Cloud Desktop not updating so I uninstalled it and tried to install the latest version from Adobe. I then get the following error:
    We've encountered the following issues:
    There seems to be a problem accessing a critical file/directory during download. For troubleshooting tips. please visit our customer support page. (Error code: 204)
    [retry] [cancel]
    This has happened all last week. Because we have been so busy at work I waited until the weekend to contact the 24/7 chat support.
    This was going well. I was sharing my desktop with the agent who was adjusting the permissions of some folder. The problem came when he launched chrome on Parallels and not on the MAC and tried to install the PC EXE version of CC desktop. When I pointed this out to the Agent he instantly stop the screen share and stated in the chat box that virtual computers are not supported and I must find my own solution without giving me an opportunity to explain.
    Every time I tried to start the chat again I was cut-off while trying to explain that Adobe CC was running natively under a native OS X and the Virtual PC was a separate to this
    Only after my 4th attempt (having per cut an pasted my arguement into the chat box) did a get any further. The Agent refused to continue to try and fix my problem but did say the Adobe engineers are aware of the "204" error
    Has anyone else had this "204" error installing Creative Cloud Desktop or can  direct me to a solution it would be much appreciated

    Unfortunately I am still getting the 204 error
    I download the Creative Cloud Desktop App at home and brought it into work to install — which failed
    I then tried to install the same file on the only Mac in the office not on Creative Cloud and it installed with out any problems
    I then tried plugging my iMac into the same ethernet socket incase it was a problem with the ethernet socket. No luck it still had the 204 error
    These are the Adobe download log files which show errors but they me nothing to me
    DLM.log
    07/01/14 08:15:48:723 | [INFO] |  |  |  |  |  |  | 1743186 | *******************start of Download****************
    07/01/14 08:15:48:723 | [INFO] |  |  |  |  |  |  | 1743186 | GDE Version is 2.0.0.13 (BuildVersion: 2.0; BuildDate: Thu Jan 09 2014 20:38:50 )
    07/01/14 08:15:48:724 | [INFO] |  |  |  |  |  |  | 1743186 | The file to be downloaded is https://prod-rel-ffc.oobesaas.adobe.com/adobe-ffc-external/core/v1/applications?name=Creat iveCloud&name=CCLBS&osVersion=10.8.5&platform=osx10
    07/01/14 08:15:48:724 | [INFO] |  |  |  |  |  |  | 1743186 | Going to download the file at /tmp/B58E0DB2-C6AD-4480-B614-874A46E27582/applications.xml
    07/01/14 08:15:48:825 | [INFO] |  |  |  |  |  |  | 1743186 | Preference: Client has set the preference for single stream download
    07/01/14 08:15:50:036 | [INFO] |  |  |  |  |  |  | 1743190 | **File download complete.**
    07/01/14 08:15:50:537 | [INFO] |  |  |  |  |  |  | 1743182 | *******************End****************
    07/01/14 08:15:50:690 | [INFO] |  |  |  |  |  |  | 1743203 | *******************start of Download****************
    07/01/14 08:15:50:690 | [INFO] |  |  |  |  |  |  | 1743203 | GDE Version is 2.0.0.13 (BuildVersion: 2.0; BuildDate: Thu Jan 09 2014 20:38:50 )
    07/01/14 08:15:50:690 | [INFO] |  |  |  |  |  |  | 1743203 | The file to be downloaded is https://ccmdls.adobe.com/AdobeProducts/KCCC/1/osx10/packages/ACCC_2_6_PDIMPackage_393/mani fest.xml
    07/01/14 08:15:50:690 | [INFO] |  |  |  |  |  |  | 1743203 | Going to download the file at /manifest.xml
    07/01/14 08:15:50:791 | [INFO] |  |  |  |  |  |  | 1743203 | Preference: Client has set the preference for single stream download
    07/01/14 08:15:51:900 | [ERROR] |  |  |  |  |  |  | 1743206 | An error has occurred while renaming the temporary named downloaded file.
    07/01/14 08:15:52:213 | [INFO] |  |  |  |  |  |  | 1743182 | *******************End****************
    LBS.log
    07/01/14 08:15:43:357 | [INFO] |  | ACC | LBS | ApplicationFacade |  |  | 1742865 | ****************Starting LBS workflow*******************
    07/01/14 08:15:43:361 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1742865 | Product Sap Code not specified in the product information file
    07/01/14 08:15:43:361 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1742865 | Applet Version not specified in the product information file
    07/01/14 08:15:43:361 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1742865 | Applet ID not specified in the product information file
    07/01/14 08:15:43:361 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1742865 | Product locale not specified in the product information file
    07/01/14 08:15:43:362 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1742865 | Product name not specified in the product information file
    07/01/14 08:15:43:362 | [INFO] |  | Download | LBS | LBSUtils |  |  | 1742865 | Launching LBS in elevated mode
    07/01/14 08:15:48:442 | [INFO] |  | ACC | LBS | ApplicationFacade |  |  | 1743172 | ****************Starting LBS workflow*******************
    07/01/14 08:15:48:446 | [INFO] |  | ACC | LBS | WorkflowManager |  |  | 1743172 | LBS launched in LEGACY mode
    07/01/14 08:15:48:524 | [INFO] |  | Download | LBS | SystemCheck |  |  | 1743182 | System OS Version - major = 10, minor = 8, bugFix = 5
    07/01/14 08:15:48:524 | [INFO] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | ACCC System requirements check passed
    07/01/14 08:15:48:546 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1743182 | Product Sap Code not specified in the product information file
    07/01/14 08:15:48:546 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1743182 | Applet Version not specified in the product information file
    07/01/14 08:15:48:546 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1743182 | Applet ID not specified in the product information file
    07/01/14 08:15:48:547 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1743182 | Product locale not specified in the product information file
    07/01/14 08:15:48:547 | [INFO] |  | Download | LBS | ProductInfo |  |  | 1743182 | Product name not specified in the product information file
    07/01/14 08:15:48:547 | [INFO] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | Bootstrap LBS is successful
    07/01/14 08:15:48:565 | [INFO] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | Bootstrapper Lock acquired
    07/01/14 08:15:48:583 | [INFO] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | LBS Lock acquired
    07/01/14 08:15:48:604 | [INFO] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | Deployment lock check passed
    07/01/14 08:15:48:622 | [INFO] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | The resolved URL for package service is https://prod-rel-ffc.oobesaas.adobe.com/adobe-ffc-external/core/v1/applications?name=Creat iveCloud&name=CCLBS&osVersion=10.8.5&platform=osx10
    07/01/14 08:15:50:538 | [INFO] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | Successfully downloaded application xml at path /tmp/B58E0DB2-C6AD-4480-B614-874A46E27582/applications.xml
    07/01/14 08:15:50:588 | [ERROR] |  | ACC | LBS | WorkflowManager |  | FileUtils | 1743182 | Error Failed open the dylib /Applications/Utilities/Adobe Creative Cloud/utils/AdobePIM.dylib while getting its version
    07/01/14 08:15:50:588 | [ERROR] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | Failed to get the PIM version from location: /Applications/Utilities/Adobe Creative Cloud/utils/AdobePIM.dylib
    07/01/14 08:15:50:588 | [ERROR] |  | ACC | LBS | PDM | PackageDownloadManager |  | 1743182 | Failed to create folder at temp location for download operations
    07/01/14 08:15:51:900 | [WARN] |  | ACC | LBS | PDM | PDMWorkflowManager |  | 1743206 | A user retryable error has occured while downloading the file. errotType = -100 extendedErrorCode = 0
    07/01/14 08:15:51:910 | [WARN] |  | ACC | LBS | PDM | PackageDownloadManager |  | 1743203 | Manifest file could not be downloaded
    07/01/14 08:15:51:910 | [INFO] |  | ACC | LBS | PDM |  |  | 1743203 | File already exist. This should not happen because packages is downloaded in new GUID folder and file is send by client so should not be there already.
    07/01/14 08:15:52:213 | [ERROR] |  | ACC | LBS | WorkflowManager |  |  | 1743182 | Failed in DOWNLOAD PIM
    07/01/14 08:15:57:938 | [INFO] |  | Download | LBS | ETS |  |  | 1743172 | Waiting for the async thread to get the task completed
    07/01/14 08:15:57:939 | [INFO] |  | Download | LBS | ETS |  |  | 1743185 | Async thread is completed. Now exiting from function.
    07/01/14 08:15:57:949 | [INFO] |  | ACC | LBS | ApplicationFacade |  |  | 1743172 | ACC installation end with exit code: 204
    07/01/14 08:15:57:949 | [INFO] |  | ACC | LBS | ApplicationFacade |  |  | 1743172 | ****************Closing LBS workflow*******************
    07/01/14 08:15:57:959 | [INFO] |  | ACC | LBS | ApplicationFacade |  |  | 1742865 | ****************Closing LBS workflow*******************

  • When opening the latest version of Iphoto an error message appears that says; You can't open your current iphoto library using this version of Iphoto. You have made changes to your photo library using a newer version of iphoto. Please quit and use the lat

    When opening the version of Iphoto i have an error message appears that says; You can't open your current iphoto library using this version of Iphoto. You have made changes to your photo library using a newer version of iphoto. Please quit and use the latest version of iphoto. What? If I can't open the current library using the latest version of iphoto, and I am asked to make changes the the newest version!!! I'm asked to run in circles chasing my tail...I had a new hard drive installed about 6 weeks ago. I am running MAC OS 10.5.8

    What version of iPhoto do you have? If you're on 10.5 then you're not running the latest iPhoto
    Any chance that the library was opened with another version?
    Simplest solution will be to just restore from your back up.

  • You can't open photo library using this version of iphoto. you have made changes to your photo library using a newer version of iphoto. please quit and use the latest version of iphoto

    you can't open photo library using this version of iphoto. you have made changes to your photo library using a newer version of iphoto. please quit and use latest version of iphoto. iphoto 11 is installed.

    This is a message you got?
    If so, as your post isn't clear, it may be a bogus message caused by a corrupt database.
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • You have an error in your SQL syntax;

    i have a checkout page that i am trying to send to a payment centre but and getting the following error
    You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '16)' at line 1
    can someone help and tell me what this means does it mean "conflict with columns definitions"
    if so what can i do to solve the issue? do you need to see the page code?
    thanks

    <?php require_once('Connections/wibbles.php'); ?>
    <?php
    // do not cache
    header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");                      // Date in the past
    header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
    header ("Cache-Control: no-cache, must-revalidate");                    // /1.1
    header ("Pragma: no-cache");                                            // /1.0
    // *** Restrict Access To Page: Grant or deny access to this page
    $FX_authorizedUsers=" ";
    $FX_authFailedURL="login.php";
    $FX_grantAccess=0;
    if (!session_id()) session_start();
    if (isset($_SESSION["MM_Username"])) {
      if (true || !(isset($_SESSION["MM_UserAuthorization"])) || $_SESSION["MM_UserAuthorization"]=="" || strpos($FX_authorizedUsers, $_SESSION["MM_UserAuthorization"])) {
        $FX_grantAccess = 1;
    if (!$FX_grantAccess) {
      $FX_qsChar = "?";
      if (strpos($FX_authFailedURL, "?")) $FX_qsChar = "&";
      $FX_referrer = "Restricted Area";
      $FX_authFailedURL = $FX_authFailedURL . $FX_qsChar . "accessdenied=" . urlencode($FX_referrer);
      header("Location: $FX_authFailedURL");
      exit;
    // *** Retrieve X ID ***
    if (!session_id()) session_start();
    $XC_OrderIdSessionVar = "OrderID";
    if (!isset($_SESSION[$XC_OrderIdSessionVar])) {
      // Get a unique OrderID number and save to session.
      $XC_tableName = "wibble_nextorder";
      $XC_fieldName = "NextOrderID";
      mysql_select_db($database_wibbles, $wibbles);
      $XC_IdSource = "select " . $XC_fieldName . " from " .  $XC_tableName;
      $XC_rsId = mysql_query($XC_IdSource, $wibbles) or die(mysql_error());
      $row_XC_rsId = mysql_fetch_assoc($XC_rsId);
      $_SESSION[$XC_OrderIdSessionVar] = $row_XC_rsId[$XC_fieldName];
      $$XC_OrderIdSessionVar = $_SESSION[$XC_OrderIdSessionVar];
      session_register($XC_OrderIdSessionVar);
      $XC_next = $_SESSION[$XC_OrderIdSessionVar] + 1;
      $XC_upd = "update " . $XC_tableName . " set " . $XC_fieldName . " = " . $XC_next;
      $XC_rsId = mysql_query($XC_upd, $wibbles) or die(mysql_error());
      $XC_rsId = null;
    // x limit validation
    if (isset($_POST["XC_Limit"]) && $_POST["XC_Limit"] != "") {
      $XC_limErr = stripslashes($_POST["XC_Limit"]);
      if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
      unset($HTTP_POST_VARS);
      unset($_POST);
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    // x limit validation
    if (isset($_POST["XC_Limit"]) && $_POST["XC_Limit"] != "") {
      $XC_limErr = stripslashes($_POST["XC_Limit"]);
      if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
      unset($_POST);
      unset($_POST);
    // Validate X amount
    if (isset($_POST["XC_Amount"]) && $_POST["XC_Amount"] < 10) {
        if (isset($_GET['XC_SaveCartToTable'])) unset($_GET['XC_SaveCartToTable']);
        unset($_POST);
        unset($_POST);
        $XC_amErr = "The amount doesn't reach the allowed minimum of &euro; 100.";
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
      $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
      switch ($theType) {
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;   
        case "long":
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      return $theValue;
    $editFormAction = $_SERVER['PHP_SELF'];
    if (isset($_SERVER['QUERY_STRING'])) {
      $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
    if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
      $insertSQL = sprintf("INSERT INTO wibble_orders (OrderID, CustomerID, OrderDate, Shipping, Discount, Tax, Total) VALUES (%s, %s, %s, %s, %s, %s, %s)",
                           GetSQLValueString($_POST['OrderID'], "int"),
                           GetSQLValueString($_POST['CustomerID'], "int"),
                           GetSQLValueString($_POST['OrderDate'], "date"),
                           GetSQLValueString($_POST['Shipping'], "double"),
                           GetSQLValueString($_POST['Discount'], "double"),
                           GetSQLValueString($_POST['Tax'], "double"),
                           GetSQLValueString($_POST['XC_Amount'], "double"));
      mysql_select_db($database_wibbles, $wibbles);
      $Result1 = mysql_query($insertSQL, $wibbles) or die(mysql_error());
    // *** X Shopping Cart ***
    $useSessions = true;
    $XCName = "wibbleJakeCart";
    $XCTimeout = 30;
    $XC_ColNames=array("ProductID","Quantity","Name","Color","Price","MinQty","Discount","Stoc k","Total");
    $XC_ComputedCols=array("","","","","","","","","Price");
    require_once('XCInc/XCart.inc');
    $colname_rsCustomer = "1";
    if (isset($_SESSION['MM_UserAuthorization'])) {
      $colname_rsCustomer = $_SESSION['MM_UserAuthorization'];
    mysql_select_db($database_wibbles, $wibbles);
    $query_rsCustomer = sprintf("SELECT * FROM wibble_customers WHERE CustomerID = %s", GetSQLValueString($colname_rsCustomer, "int"));
    $rsCustomer = mysql_query($query_rsCustomer, $wibbles) or die(mysql_error());
    $row_rsCustomer = mysql_fetch_assoc($rsCustomer);
    $totalRows_rsCustomer = mysql_num_rows($rsCustomer);
    // *** Redirect if XCart is Empty ***
    $XC_RedirectIfEmpty = "shopping-cart.php";
    if (isset($_SERVER["QUERY_STRING"])) {
      $XC_RedirectIfEmpty .= "?" . htmlentities($_SERVER["QUERY_STRING"]);
    if (isset(${$XCName}["contents"]) && (sizeof(${$XCName}["contents"][0]) == 0)) header("Location: " . $XC_RedirectIfEmpty);
    // *** Repeat XCart region *** (do not remove this label)
    // validate x limit
    $XC_invalidItems = "";
    $XC_lim = "";
    $iCol = array_search("Quantity",${$XCName}["ColNames"]);
    $iSrc = array_search("Stock",${$XCName}["ColNames"]);
    for ($iVal=0; $iVal<sizeof(${$XCName}["contents"][0]); $iVal++) {
      if (${$XCName}["contents"][$iCol][$iVal] > ${$XCName}["contents"][$iSrc][$iVal]) {
        if ($XC_invalidItems != "") $XC_invalidItems .= "-";
        $XC_invalidItems .= (string) ($iVal+1);
        if ($XC_lim != "") $XC_lim .= "-";
        $XC_lim .= (string) ${$XCName}["contents"][$iSrc][$iVal];
    if ($XC_invalidItems != "") {
      $XC_invalidItems = "(".$XC_invalidItems.")";
      $XC_lim = "(".$XC_lim.")";
      $x_limErr = "The item(s) $XC_invalidItems exceed the available stock of $XC_lim";
    // *** Add shipping based on Range
    mysql_select_db($database_wibbles, $wibbles);
    $XC_sourceVal = $XCart_sumTotal;
    $XC_ShipSource = "SELECT Shipping FROM wibble_shipbyprice WHERE MinPurchase < " . $XC_sourceVal . " AND MaxPurchase >= " . $XC_sourceVal;
    $XC_rsShip = mysql_query($XC_ShipSource, $wibbles) or die(mysql_error());
    $row_XC_rsShip = mysql_fetch_assoc($XC_rsShip);
    $XC_Shipping = $row_XC_rsShip['Shipping'];
    $XC_rsShip = null;
    // *** Add Referenced Sales Tax
    mysql_select_db($database_wibbles, $wibbles);
    $XC_taxSource = "SELECT Tax FROM wibble_tax WHERE Country = '" . $row_rsCustomer['Country'] . "'";
    $XC_rsTax = mysql_query($XC_taxSource, $wibbles) or die(mysql_error());
    $row_XC_rsTax = mysql_fetch_assoc($XC_rsTax);
    $XC_Tax = $row_XC_rsTax['Tax'];
    $XC_rsTax = null;
    $XC_SalesTax = $XC_Tax*($XCart_sumTotal+$XC_Shipping-$XC_Discount);
    // *** Compute Grand Total
    $XC_GranTotal = $XCart_sumTotal+$XC_SalesTax+$XC_Shipping-$XC_Discount;
    // *** Format table as Europe style
    if (!session_id()) session_start();
    // set header 
    $XC_header = "<style type=\"text/css\">\n<!--\n";
    $XC_header .= "table {font-family: Arial, Helvetica, sans-serif; font-size: 13px;}\n";
    $XC_header .= "-->\n</style>\n";
    $XC_header .= "<table width=\"520\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">\n";
    $XC_header .= "  <tr>\n    <td>\n";
    $XC_header .= "<table width=\"100%\" border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
    $XC_header .= "  <tr>\n    <td> </td>\n    <td align=\"right\"> </td>\n  </tr>\n";
    $XC_header .= "  <tr>\n    <td>Order n. <b>" . $_SESSION["OrderID"] . "</b></td>\n    <td align=\"right\"> " . date("d/m/Y") . "</td>\n  </tr>\n";
    $XC_header .= "  <tr>\n    <td> </td>\n    <td> </td>\n  </tr>\n";
    $XC_header .= "  <tr>\n    <td colspan=\"2\" align=\"Left\">";
    $XC_header .= $row_rsCustomer["FirstName"] . " ";
    $XC_header .= $row_rsCustomer["LastName"] . " <br>";
    $XC_header .= $row_rsCustomer["Address"] . " <br>";
    $XC_header .= $row_rsCustomer["ZIP"] . " ";
    $XC_header .= $row_rsCustomer["City"] . " ";
    $XC_header .= $row_rsCustomer["State"] . " <br>";
    $XC_header .= $row_rsCustomer["Country"] . " <br>";
    $XC_header .= "</td>\n  </tr>\n</table>\n";
    $XC_header .= "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
    $XC_header .= "  <tr>\n    <td colspan=\"5\"> </td>\n  </tr>\n";
    $XC_header .= "  <tr>\n    <td colspan=\"5\">Cart contents: </td>\n  </tr>\n";
    // set cart data 
    $XCartData = "  <tr>\n";
    $XCartData .= "    <th width=\"30\" bgcolor=\"#CC6600\"><font color=\"white\">Qty</font></th>\n";
    $XCartData .= "    <th width=\"310\" bgcolor=\"#CC6600\"><font color=\"white\">Description</font></th>\n";
    $XCartData .= "    <th width=\"60\" bgcolor=\"#CC6600\"><font color=\"white\">Price</font></th>\n";
    $XCartData .= "    <th width=\"40\" bgcolor=\"#CC6600\"><font color=\"white\">Disc</font></th>\n";
    $XCartData .= "    <th width=\"80\" bgcolor=\"#CC6600\"><font color=\"white\">Total</font></th>\n";
    $XCartData .= "  </tr>\n";
    for ($jRow=0; $jRow<sizeof(${$XCName}["contents"][0]); $jRow++) {
      require('XCInc/RepeatXMailRegion.inc');
      $XCartData .= "  <tr>\n";
      $XCartData .= "    <td align=\"Center\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][1][$jRow] . "</td>\n";
      $XCartData .= "    <td align=\"Left\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][2][$jRow] . "</td>\n";
      $XCartData .= "    <td align=\"Right\" bgcolor=\"#FFFF99\">&euro; " . number_format(${$XCName}["contents"][4][$jRow], 2, ',', '.') . "</td>\n";
      $XCartData .= "    <td align=\"Center\" bgcolor=\"#FFFF99\">" . ${$XCName}["contents"][6][$jRow] . "</td>\n";
      $XCartData .= "    <td align=\"Right\" bgcolor=\"#FFFF99\">&euro; " . number_format(${$XCName}["contents"][8][$jRow], 2, ',', '.') . "</td>\n";
      $XCartData .= "  </tr>\n";
    // set footer
    $XC_footer = "  <tr>\n    <td colspan=\"4\" align=\"right\"><b> SubTotal </b></td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"><b> &euro; " . number_format($XCart_sumTotal, 2, ',', '.') . "</b></td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"4\" align=\"right\"> Shipping </td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"> &euro; " . number_format($XC_Shipping, 2, ',', '.') . "</td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"4\" align=\"right\">  </td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"> </td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"4\" align=\"right\"> Sales Tax </td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"> &euro; " . number_format($XC_SalesTax, 2, ',', '.') . "</td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"4\" align=\"right\"><b> Grand Total </b></td>\n    <td align=\"right\" bgcolor=\"#FFFF99\"><b> &euro; " . number_format($XC_GranTotal, 2, ',', '.') . "</b></td>\n  </tr>\n";
    $XC_footer .= "  <tr>\n    <td colspan=\"5\"> </td>\n  </tr>\n";
    $XC_footer .= "</table>\n    </td>\n  </tr>\n</table>\n";
    // join all
    if (isset($_SESSION["XC_CartMail"])) session_unregister("XC_CartMail");
    $XC_CartMail = $XC_header . $XCartData . $XC_footer;
    $_SESSION["XC_CartMail"] = $XC_CartMail;
    session_register("XC_CartMail");
    // *** Save XCart contents to table ***
    require_once('XCInc/XCsaveAction.inc');
    if (isset($_GET['XC_SaveCartToTable']) && ($_GET['XC_SaveCartToTable'] == "1")) {
      $XC_destColName = array("ProductID","Quantity","","Color","UnitPrice","","Discount","","Total");
      $XC_destColType = array("str","num","str","str","num","num","num","num","num");
      $XC_orderId = $_SESSION['OrderID'];
      $XC_tableName = "wibble_orderdetails";
      $XC_OrderIDCol = "OrderID";
      $XC_OrderIDType = "num";
      $XC_AddToTableRedirect = "thanks.php";
      $XC_conName = "wibbles";
      require_once('XCInc/SaveXCartToTable.inc');
    // clone a session
    if (!session_id()) session_start();
    if (isset($_SESSION["OrderNum"])) session_unregister("OrderNum");
    if (isset($_SESSION["OrderID"])) {
      $OrderNum = $_SESSION["OrderID"];
      $_SESSION["OrderNum"] = $OrderNum;
      session_register("OrderNum");
    function DoFormatCurrency($theObject,$NumDigitsAfterDecimal,$DecimalSeparator,$GroupDigits,$Curren cySymbol) {
              $currencyFormat=$CurrencySymbol.number_format($theObject,$NumDigitsAfterDecimal,$Dec imalSeparator,$GroupDigits);
              return ($currencyFormat);
    function DoFormatPercent($theObject,$NumDigitsAfterDecimal,$DecimalSeparator,$GroupDigits) {
              $currencyFormat=number_format($theObject*100,$NumDigitsAfterDecimal,$DecimalSeparato r,$GroupDigits).'%';
              return ($currencyFormat);
    ?>

Maybe you are looking for