Professional Web Applications Themes

multiple databases - PHP Development

Hi, How can I set up PHP to work with multiple databases in the same page? (not tables) That's all, Thanks PN...

Sponsored Links
  1. #1

    Default multiple databases

    Hi,



    How can I set up PHP to work with multiple databases in the same page?
    (not tables)





    That's all,



    Thanks



    PN




    Sponsored Links
    Paulo Neves Guest

  2. #2

    Default Re: [PHP] multiple databases

    Paulo Neves <sevenlafoes.com> wrote:
    > Hi,
    >
    >
    >
    > How can I set up PHP to work with multiple databases in the same page?
    > (not tables)
    $dbh1 = server_connect(params...);
    $dbh2 = server_connect(params...);

    Just be sure to pass the optional $dbh1 or $dbh2 to the appropriate
    query.

    $result1 = server_query($sql_fordb1, $dbh1);
    $result2 = server_query($sql_fordb2, $dbh2);
    >
    > That's all,
    > Thanks
    >
    No problem

    Curt
    --

    Curt Zirzow Guest

  3. #3

    Default Multiple databases

    Hey,

    I was told that it's faster for the user if you split all your tables up into
    seperate databses. Now I've done that, I'm not sure if it was wise - How can I
    merge these databases again in a CFML page? I want to use one query cos I want
    to make a record set nav bar...

    I am making a clothes store like Kays except it's for a sole trader and I've
    split my tables into each category (jeans, shirts, dresses etc) and so instead
    of making a .cfm for each category, I just wanna make the link "Dresses" filter
    through the catalogue for dresses.

    Is this possible: (code attatched)

    Where #URL.Message# is Dresses or whatever?

    And can I set the message like this? (second code)

    I will REALLY appreciate any help given.

    Thanks,
    JR

    <cfquery name="Recordset1" datasource="#URL.Message#">
    SELECT name, description FROM #URL.Message#

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

    <cfset browsepage = "browse.cfm?Message=" & URLEncodedFormat("dresses")>
    <cflocation url="#browsepage#">

    _Roudh Guest

  4. #4

    Default Re: Multiple databases

    > Hey,
    >
    > I was told that it's faster for the user if you split all your tables up
    into
    > seperate databses. Now I've done that, I'm not sure if it was wise
    You don't need to split your tables into separate databases. Current systems
    can handle a lot of tables in the same db just fine.

    - How can I
    > merge these databases again in a CFML page? I want to use one query cos I
    want
    > to make a record set nav bar...
    Depends on your db, but generally it's something like this:

    SELECT *
    FROM db1.table1
    UNION
    SELECT *
    FROM db2.table2

    > I am making a clothes store like Kays except it's for a sole trader and
    I've
    > split my tables into each category (jeans, shirts, dresses etc) and so
    instead
    > of making a .cfm for each category, I just wanna make the link "Dresses"
    filter
    > through the catalogue for dresses.
    >
    > Is this possible: (code attatched)
    >
    > Where #URL.Message# is Dresses or whatever?
    >
    > And can I set the message like this? (second code)
    Don't. You'll be open to SQL injection.
    [url]http://www.carsinlondon.com/sql-injection-in-coldfusion.html[/url]

    --
    <mack />


    Neculai Macarie Guest

  5. #5

    Default Re: Multiple databases

    Hi,

    Thanks for that. It's given me a lot to think about. But I'm afraid I do need
    more info. You said that current systems can handle lots of tables? I have
    about 11 categories. Each with at least ten items in them. Can I put 11 tables
    into one MS Access db?

    What would be the best way?

    Thanks for the info :)
    JR

    _Roudh Guest

  6. #6

    Default Re: Multiple databases

    Access can handle hundreds of tables and thousands of records. You do not
    need a separate table for each category as this is a complete waste of time,
    as it will require you to maintain separate update scripts for each one.
    Using relationship database design you would have three tables name,
    products categories and a listing one that will bring the two together. That
    way one product can belong to multiple categories without having to
    duplicate the record information.

    --
    Paul Whitham
    Certified Dreamweaver MX2004 Professional
    Team Macromedia Volunteer for Dreamweaver

    Valleybiz Internet Design
    [url]www.valleybiz.net[/url]

    "_Roudh" <webforumsusermacromedia.com> wrote in message
    news:da9hpu$k1i$1forums.macromedia.com...
    > Hi,
    >
    > Thanks for that. It's given me a lot to think about. But I'm afraid I do
    > need
    > more info. You said that current systems can handle lots of tables? I have
    > about 11 categories. Each with at least ten items in them. Can I put 11
    > tables
    > into one MS Access db?
    >
    > What would be the best way?
    >
    > Thanks for the info :)
    > JR
    >

    Paul Whitham TMM Guest

  7. #7

    Default Re: Multiple databases

    THANKYOU! :)

    I am VERY grateful for that.

    I should stick to designing! :)
    _Roudh Guest

Similar Threads

  1. Query using multiple databases?
    By Gary1 in forum Coldfusion - Advanced Techniques
    Replies: 4
    Last Post: July 4th, 11:44 AM
  2. One ASP Site...Multiple Databases
    By Mike Hill in forum ASP Database
    Replies: 3
    Last Post: April 16th, 06:44 AM
  3. [PHP] Databases
    By Duncan Hill in forum PHP Development
    Replies: 1
    Last Post: September 25th, 09:48 AM
  4. Federated Databases, joins across databases etc
    By Benjamin Stewart in forum IBM DB2
    Replies: 2
    Last Post: August 1st, 03:05 PM
  5. [PHP] multiple databases
    By Jeff Harris in forum PHP Development
    Replies: 0
    Last Post: July 16th, 03:56 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139