Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9103335
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T01:36:38+00:00 2026-06-17T01:36:38+00:00

Currently for our login system etc we use a connect.php file with the following

  • 0

Currently for our login system etc we use a connect.php file with the following contents

$connect_error = 'Sorry, we\'re currently experiencing connection problems.';
mysql_connect('localhost', 'x', 'x') or die($connect_error);
mysql_select_db('x');

We are currently developing a system that we would like users to be able to add devices to their account

The main table we have stores all the users info e.g. First Name, Last Name, Email, Password

To this table we are adding the following fields – Device 1, Device 2, Device 3

Along side this we would also like to have access to another database, we want to hold the device id’s in the main database so we know who owns what devices.

The second database will consist of Device ID, Lat, Long, Time

We would like to be able to read out of either database, I’m not sure how we would specify the database to connect to as I’ve only ever dealt with the one database

I’m not sure if its doable or if i’m going about it the totally wrong way – Both databases will be on the same server and we can assign the same user to both databases if that helps

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T01:36:39+00:00Added an answer on June 17, 2026 at 1:36 am

    First of all, You should not use mysql_* functions as the are deprecated. Use MySQLi or PDO for this.

    In Mysql the solution is to use the link identifier returned by mysql_connect. But if you use MySQLi or PDO you need to create those object first and use that object. OOP interface of MySQLi has NO concept of link identifier. Read this page from PHP manual that helps you to migrate. For PDO use this tutorial to learn.

    For MySQLi extension, its already a object and the object contains database information.

    $db1 = new mysqli(...);
    $db2 = new mysqli(...);
    
    // sending query in database 1
    $db1->query("...") 
    
    // sending query in database 2
    $db2->query("...") 
    

    For MySQL extension, mysql_connect() returns a links identifier. You should save it in a variable and use it.

    $link1 = mysql_connect();
    mysql_select_db($dbnane, $link1);
    
    $link2 = mysql_connect();
    mysql_select_db($dbnane, $link2);
    
    In query you should use it like this,
    
    mysql_query($query, $link1); // query in first db
    
    mysql_query($query2, $link2); // query in second db;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently developing a monthly checklist system for our organization. A user may login,
We currently use the MSXML.dll from Classic ASP for certain parts of our system.
Currently on our system, when a user contacts us, we reply via our admin
currently we have quite a chunky auditing system for objects within our application, the
I have a program that we use to connect our Magento store to our
Currently our website uses links to allow the user to change their locale. The
Currently our queries add a variety of Restrictions to ensure the results are considered
Currently our dev team uses this pattern, but I can't help but wonder if
Currently our code uses a for-loop for filling a buffer holding a Unicode string
Currently all our GUI components are written in MFC. Our build environment is: VC

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.