Connecion issue


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

For some reason, I keep getting this error when trying to connect:

Warning: mysql_connect() [function.mysql-connect]: Can't connect to MySQL server on...
Warning: mysql_select_db() [function.mysql-select-db]: Can't connect to local MySQL server through socket...
Warning: mysql_select_db() [function.mysql-select-db]: A link to the server could not be established...

This is my php code:


<?php
//database connection settings
$db_username = "test";
$db_password = "test";
$db_host = "test";
$db_name = "test";

$connection = mysql_connect($db_username, $db_password, $db_host);
if(!$connection){
echo"Cannot connect to database! Please check the settings";
}

else{
echo"Database Connection Successful";
}

mysql_select_db($db_name);
echo"Database Connection Successful";

?>


Any ideas whats wrong?

No comments posted yet

Your Answer:

Login to answer
173 Like 32 Dislike
Previous forums Next forums
Other forums

Change Sort Order to Display Newest File First
Hi Guys,

I have a page that sorts the contents (PDFs) of a directory and displays them on the

Logging and nologging bulk insert
Hi,

oracle version: 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

creating a 1 to 100 in a table
hi guys I am a newb in php need some help.

I have a table with 1 column and 100 rows and in

problem with php server update from mid 2009
Hi,

I have this navigation menu on 2 websites which used to work just fine. After a recent up

check if string contain only a-z/A-Z
Is where any way to check if string contains only a-z/A-Z, without writing an array with all possibl

mysql query with single quotes in a variable
$sitedetails = "INSERT INTO vars (address, sitename, description, ownername, theme) VALUES ('$u

WM transfer order: confirm different batch than proposed by system
Hi folks,

following scenario: we have a full WM with mixed batch numbers allowed in stora

Packet Design
Hi All,
Im new about network programming and I want to design a protocol but I have some question

Extract specific information from a PHP Multidimensional Array
Howdy! I've racked my brain over this for 24 hours now. I think it's time I asked for help. I'm lear

help with this code please?
Hello,

I am trying to build a remote upload script for my image hosting site.

I am usi

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash