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

pspell
using pspell, is it possible to get words that would be best in the current phrase?

For examp

How to use php and sql to check if values match the ones in a table (for logins)
How would I code it that the script takes two variables that are passed to it (UserID and PIN), and

Gridview Not updating in Update Panel
I have a gridview, three dropdown list boxes, and a button on my form. What is displayed in the gri

Where do I put CRON code
So I've figured out alot about how to automatically run a php function. I can't figure out where to

date function help
i need help with date function

Code: [Select]<!DOCTYPE HTML PUBLIC "-//W3C//DTD H

Problem in OnClientClick and OnClick sync
Hi,Strange and irritating problem: I have below button declaration in markup of the aspx page:

how to transport the Query and insfoset
Hi

I have created the query using SQ01........
How to created T-code for query..

Aris, Netweaver BPM, Visual composer and X'app
Dear Experts,

Whats the relationship between the following components: Aris, Netweaver BP

Help on Order Entry Form/System Where is best to begin.
I have a dilema and a very short amount of time at this point and I'm looking for some help on decid

Displaying a clickable playername
I am going wrong somewhere with the mysql_query, can someone please put me straight?

$playern

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