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

  • Home
  • SEARCH
  • 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 7560107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:48:46+00:00 2026-05-30T12:48:46+00:00

I have created a ‘db.php’ file where I make a connection to my db:

  • 0

I have created a ‘db.php’ file where I make a connection to my db:

$db_user = 'usprojus';
$db_pass = 'xxxxxx';
$db_host = 'localhost';
// Verbinden
$dblink = mysqli_connect($db_host, $db_user, $db_pass);
// Datenbank "myproject" auswaehlen
// Entspricht "USE myproject;"
$selected = mysqli_select_db($dblink, 'myproject');
if (!$selected) {
    die ('Cannot use DB : '.mysqli_error($dblink));
}
mysqli_set_charset($dblink, 'utf8');

In order to test that is working I am trying to get data from my ‘users’ table:

require_once('db.php'); 

// Get all the data from the "users" table
$result = mysql_query("SELECT * FROM users") 
or die(mysql_error());  


// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $result )) {
    // Print out the contents of each row into a table
    echo 'user_id: '.$row['user_id'].'<br />';
    echo 'date_registered: '.$row['date_registered'].'<br />'; 
    echo 'last_login: '.$row['last_login'].'<br />';
    echo 'username: '.$row['username'].'<br />';
    echo 'email: '.$row['email'].'<br />';
    echo 'password: '.$row['password'].'<br />';
    echo 'photo: '.$row['photo'].'<br />';
    echo 'description: '.$row['description'].'<br />';
    echo 'notify: '.$row['notify'].'<br />';

}

But I get this error in the browser:

No database selected

For the life of me I cannot figure out where the problem lies.

Sorry, I know this is a newbie question, and it seems it has been posted here several times. But I could not figure it out.

Thank you for your time and patience.

  • 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-05-30T12:48:47+00:00Added an answer on May 30, 2026 at 12:48 pm

    It looks like you are connecting to the database using the mysqli functions, but your query is using a mysql function.

    Try switching your query to the mysqli function:

    $result = mysqli_query("SELECT * FROM users")
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created a PHP-script to update a web server that is live inside
I have created a C# class file by using a XSD-file as an input.
i have created one jsp file but it doesn't running in any way..!! it
I have created a little program that reads in a Java file and feeds
I have created a Resource File as App.rrc(Root)and App_fr.rrc under App.rrh(header file) and have
I have created a SSRS 2008 report.I have created a matrix.I want to make
I have created a PHP form, which, upon submission, goes to another PHP page.
I have created an XML file in my solution path. My solution has multiple
I have created a smalldatetime field. I am using a dbml file to access
I have created a cookie using php and now I need to create a

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.