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 6775985
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:58:19+00:00 2026-05-26T15:58:19+00:00

I have selected the database but for some weird reason it still says that

  • 0

I have selected the database but for some weird reason it still says that it is not selected.

Connection lines:

$location = "localhost";
$user = "user";
$pass = "pass";

//Database Selection
$link = mysql_connect($location, $user, $pass); 
if (!$link) {
    die('Could not connect: ' . mysql_error());
}
//Database Selection
mysql_select_db('database') or die(mysql_error());

The Query:

while ($row_fpages = mysql_fetch_array($result_fanpage))
{
    if ( $row_fpages['client'] == NULL ) {

    //GRAPHS
    $sql = "SELECT date, likes FROM statistics_pages WHERE idnum='".$_COOKIE['id']."' AND page_name = ".$row_fpages['page_name']." LIMIT 7";
    $result_apps = mysql_query($sql) or die(mysql_error());

And the error is a plain No database selected.

I have never seen this error before and i tried to change a lot of things but its just not working.

  • 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-26T15:58:19+00:00Added an answer on May 26, 2026 at 3:58 pm

    You forgot to pass the variable $link as the link parameter.

         mysql_select_db('database', $link) or die(mysql_error());
    

    EDIT: Try passing the database in the FROM parameter like

         SELECT * FROM `database`.`table`
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a datagridview that may or may not have rows selected when the
I have a gridview that I databind dynamically in my codebehind. For some reason,
I have a radajaxpanel that is populated with the selected item from a combobox
I have a web based program which chooses some records from a database using
So I have a jquery autocomplete on a testbox that searches the database for
I have a table in an Oracle database that contains actions performed by users
I have some database information stored in config.inc.php and i'm trying to use it
I am creating a JSF application. I have some items (e.g. products) from database
I have a mysql query that shows the users last viewed documents. Some sort
I have some views that I'd like to relate together in my Linq2Sql DBML

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.