Announcement

Collapse
No announcement yet.

php odbc connections to actinic database

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    php odbc connections to actinic database

    I make a lot of use of PHP and ODBC connections to the database, 99% of the time, I get it right and ensure I "Connect to Actinic" "make the fetch from Actinic" "close the ODBC connection" and finally "release the connection and free up the resource"

    so that I can call small functions like "getPageUrl ( $productCode )" this opens, fetches, closes and releases the connection
    Similar functions can call things like "getProductImage ( $productCode )"

    Using this functionality, I can do away with duplicate pages, and create pages of links just by including the $productCode in a list. - much faster, much easier but . . .

    Like I say, normally everything is fine, but today, with nested fetches (loops) and I have now closed the connection before I have actually finished it.

    Are there an experts out there, that can advise "more efficient" ways of "connecting to actinic" at the beginning of the page, do anything I want throughout the page, and finally, "closing the connection" at the end of the page

    kev

    #2
    Originally posted by completerookie View Post

    Like I say, normally everything is fine, but today, with nested fetches (loops) and I have now closed the connection before I have actually finished it.

    Are there an experts out there, that can advise "more efficient" ways of "connecting to actinic" at the beginning of the page, do anything I want throughout the page, and finally, "closing the connection" at the end of the page

    kev
    Hi

    Use a global variable,

    You can open the connection using the global variable to hold the handle at the beginning of the code and pass this variable to the various functions, then at the end of the script close the connection. This will also speed up the code quite dramatically if you are using nested loops that open and close the connection to the database regularly.

    Malcolm

    SellerDeck Accredited Partner,
    SellerDeck 2016 Extensions, and
    Custom Packages

    Comment


      #3
      ok,
      I'll add the open at the top of the main outer layout, do all the work by calling multiple fragments/functions , then close it at the end of the main outer layout.
      I assume that it then reads the outer layout in a sequential manner inserting fragments where required before moving on to the next line.

      Comment


        #4
        That sounds sensible.

        One area to be aware of, are the assorted List Layouts. The Start of List, List Items and End of List code is NOT evaluated in the obvious sequence. Gory details at http://community.sellerdeck.com/showthread.php?t=35541
        Norman - www.drillpine.biz
        Edinburgh, U K / Bitez, Turkey

        Comment


          #5
          ooohh
          that is gory and as you can guess goes against some of the ideas I had in mind.

          time for a re-think in the odd place
          thanks Norman

          Comment


            #6
            in the odd place
            You have a padded cell then? I want one too!
            Norman - www.drillpine.biz
            Edinburgh, U K / Bitez, Turkey

            Comment


              #7
              sorry, the missus has reserved this cell exclusively for me, she allows me out once a day *for about 20 hours) to do work for her, but after that, its back to the odd place to do the odd bit of thinking
              she assures me that the padding is just to keep the walls clean and warm

              Comment

              Working...
              X