Jump to content

Recommended Posts

Hello guys,

 

I am trying to run a script but it could not get connected to mysql and I have tried it on 2 different free hosts with different versions of php. I get this error:

 

Warning: mysql_connect(): Unknown MySQL server host 'DB_HOST' (1) in /home/u947202749/public_html/inc/functions.php on line 1918 Couldn't make connection.

 

Here is my function file with line 1917 to 1921

 function connect(){
        $link = mysql_connect(DB_HOST, DB_USER, DB_PASS) or die("Couldn't make connection.");
        $db = mysql_select_db(DB_NAME, $link) or die("Couldn't select database");
        return $db;
    }

and here is my configuration file which is 100% accurately set according to right details but I wont share them here due to security reasons.

$site_url = "http://toorhamza12.fun2pk.com";
$site_name = "Image Hosting";
$site_title = "Image Hosting Script";
$site_meta_description = "Share your images";
$site_meta_keywords = "images, share";
$site_meta_author = "Zamfi";
$site_version = "1.2";
$logo_location = "css/img/logo.png";

// ADMIN CONFIGURATIONS
define("ADMIN_EMAIL", "admin@yoursite.com"); // email address for various notifications like IPN's confirmations or error logs, contact form and other administrative things.
define("UPLOAD_ONLY_REGISTERED", 0); // 1 = UPLOAD ONLY FOR REGISTERED USERS // 0 = UPLOAD FOR EVERYBODY

// DATABASE CONFIGURATIONS
define ("hidden", ""); // set database host
define ("hidden", ""); // set database user
define ("hidden",""); // set database password
define ("hidden",""); // set database name

and so on. Please help me regarding this issue. Thank You.

 

 

// DATABASE CONFIGURATIONS
define ("hidden", ""); // set database host
define ("hidden", ""); // set database user
define ("hidden",""); // set database password
define ("hidden",""); // set database name

 

That is where they should be defined

 

eg

 

define("DB_HOST", "myhostname");

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.