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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T20:05:22+00:00 2026-06-02T20:05:22+00:00

I am facing this issue. Appreciate any advices. I have a file called home.php.

  • 0

I am facing this issue. Appreciate any advices.

I have a file called home.php. This home.php will get data from a url parameter called user.

home.php

$u = $GET_["user"];
include('config.php');

Whenever ppl entered http://www.mydomain.com/index.php?user=hello, the text “hello” will be captured and put into variable $u.

I have a database called “hello” for that specific user. In the config.php i will do sql connection to the database using the following code.

Config.php

define('DB_NAME', $u); 
define('DB_HOST', 'localhost');
define('DB_USERNAME', 'admin');
define('DB_PASSWORD', '123456');

$db = DB::getInstance();
//connect to database
$db->connect(DB_HOST,DB_USERNAME,DB_PASSWORD,DB_NAME);

Database connection class

function connect($host, $username, $password, $database) {
    mysql_connect($host, $username, $password) or die('Server connexion not possible.');
    mysql_select_db($database) or die('Database connexion not possible.');
}

Above are all code snippets.

My issue is i keep getting Database connexion not possible error. I believe everything is logically correct. To debug this, whenever i replaced define(‘DB_NAME’, $u); with define(‘DB_NAME’, “Hello”); -> it works. It seems that i cannot dynamically use the value from $u.

thnk all. help appreciated.

  • 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-02T20:05:24+00:00Added an answer on June 2, 2026 at 8:05 pm

    You’re looking to use $_GET – there is no such thing as $GET_

    $u = $_GET["user"]
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am facing this issue on Android 2.3.5 (and possibly earlier Android versions) When
Please help me with this issue that I am facing on production server. I
I'm facing this problem again and again, but can't find any solution (except mine,
Hell All, So I have been facing this behavior for quite some time and
This is a design problem I am facing. Let's say I have a cars
My development team of four people has been facing this issue for some time
I am getting this data from JSON web services List ARRAY: ( { assets
We are facing a weird issue. We have NFS set up with 2 machines
I am facing an issue with the JSON structure for the data I should
I have a user facing form, which is generated from a model. The model

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.