SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    May 2002
    0 Post(s)
    0 Thread(s)

    Question I only have 1 MySQL Database and need it to run several scripts req seperate db??

    I am looking for advice on how to run several different scripts from just 1 MySQL db?

    I imagine I can simply define a table name value ie

    $table_name = "name";

    into the script connection string??

    If not can someone point me in the right direction?

    Thanks in advance


  2. #2
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Whistler BC originally from Guelph Ontario
    0 Post(s)
    0 Thread(s)
    You are correct. Create all the instances you need from the db you wish. Then be sure when you are querying the db you specify the var it is assigned to.

    In this way you can work with all db's and thereby all tables in the mysql server.


    $query=mysql_query("select * from articls",$db1);
    $query2=mysql_query("select * from authors",$db2);

    I am sure you get the idea. You have two different databases being used at the same time with different instances of mysql.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.


Posting Permissions

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