SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mysql database and table names, etc...

    Hello one and all, and how are we today? I'm, fine thank you.

    OK, lets get down to business.

    When connecting to MySQL, i've got two diffrent databases that i need to pull info from, before each mysql_query() do I have to use the mysql_select_db() function

    OR

    Can I skip that bit and use databasename.tablename in my queryes insted?

    IR

    PHP Code:
    $result mysel_query('SELECT * FROM databasename.tablename'); 
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.

  2. #2
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can't do it that way, you could skip mysql_select_db() and use mysql_db_query()

    http://www.php.net/mysql_db_query


    PHP Code:
    $result mysql_db_query("dbname""SELECT...."); 
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  3. #3
    Making a better wheel silver trophy DR_LaRRY_PEpPeR's Avatar
    Join Date
    Jul 2001
    Location
    Missouri
    Posts
    3,428
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mysql_db_query() is deprecated. don't use it. freddy, that will work just fine to use dbname.tablename
    - Matt ** Ignore old signature for now... **
    Dr.BB - Highly optimized to be 2-3x faster than the "Big 3."
    "Do not enclose numeric values in quotes -- that is very non-standard and will only work on MySQL." - MattR

  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well, b4 i learned mysql_select_db() i always used mysql_db_query() and it workd just fine.
    just lots of extra typeing for ever query
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  5. #5
    http://TheICE.co.uk/ The Eerie Network's Avatar
    Join Date
    Apr 2001
    Location
    London in the UK.
    Posts
    293
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've just been using dbname.tblname for the past day without any trouble, I got the example from phpmyadmin and it seams to work fine, the only problem that I can see is that if your database names change, it would be an major pain in the **** updating the site.
    Daniel Hollands
    New: My Webcam <-- Come and watch me doing what I do
    TheICE.co.uk <-- New sites for the best in UK lifestyle and Competitions.
    The ofDan.Network Forums <-- Come and join in the fun.


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
  •