toorhamza Posted May 11, 2013 Share Posted May 11, 2013 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. Quote Link to comment Share on other sites More sharing options...
Barand Posted May 11, 2013 Share Posted May 11, 2013 // DATABASE CONFIGURATIONSdefine ("hidden", ""); // set database hostdefine ("hidden", ""); // set database userdefine ("hidden",""); // set database passworddefine ("hidden",""); // set database name That is where they should be defined eg define("DB_HOST", "myhostname"); Quote Link to comment Share on other sites More sharing options...
toorhamza Posted May 13, 2013 Author Share Posted May 13, 2013 Thank You Barand, I was just confused. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.