PDA

View Full Version : Figure out this for me?



Yamba
19-09-2006, 05:22 PM
Okay this is my problem I created a SQL database for my Radio Pannel and when I go to the intsaller this appears:

Warning: mysql_connect() [function.mysql-connect (http://www.habbostyle.net/djp/staff/install/function.mysql-connect)]: Host '67.18.208.126' is blocked because of many connection errors. Unblock with 'mysqladmin flush-hosts' in /home/habbosty/public_html/djp/staff/dj/sql.php on line 14
Couldn't select database.

I have to edit a file called sql.php which is like this:

<?php
//MySQL Hostname
$hostname = '';
//MySQL Database Username
$sqlname = "'';
//MySQL Database Password
$sqlpass = '';
//MySQL Database Name
$mysqldb = '';
$connection = mysql_connect($hostname, $sqlname, $sqlpass) or die("Couldn't select database.");
$db = mysql_select_db($mysqldb, $connection) or die("Couldn't select database.");
?>

Here are some connection strings I found on Cpanel:

Connection StringsPerl$dbh = DBI->connect("DBI:mysql:habbosty_djpanel:localhost","habbosty_dj","<PASSWORD HERE>");PHP$dbh=mysql_connect ("localhost", "habbosty_dj", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
mysql_select_db ("habbosty_djpanel");
Can you use these to tell me what I have to place in the blank parts of the sql.php? Or what am I doing wrong?

RyanS
19-09-2006, 05:28 PM
Before opening a site you really should learn something..

[php]
<?php
//MySQL Hostname
$hostname = 'localhost';
//MySQL Database Username
$sqlname = 'USERNAMETOCONNECT';
//MySQL Database Password
$sqlpass = 'PASSWORDTOCONNECT';
//MySQL Database Name
$mysqldb = 'PUTTHEDATABABASEHERE';
$connection = mysql_connect($hostname, $sqlname, $sqlpass) or die("Couldn't select database.");
$db = mysql_select_db($mysqldb, $connection) or die("Couldn't select database.");
?>

Yamba
19-09-2006, 05:30 PM
What's the local host and Database name?

RyanS
19-09-2006, 05:33 PM
Leave localhost as localhost and database name is the name of the database that the sql is located in, prefixed by your cpanel name, i.e. cpanellogin_databasename

Yamba
19-09-2006, 05:35 PM
If I leave it as local host will it work?

Yamba
19-09-2006, 05:44 PM
Now this comes up:

Warning: mysql_connect() [function.mysql-connect (http://www.habbostyle.net/djp/staff/install/function.mysql-connect)]: Access denied for user 'dj'@'localhost' (using password: YES) in /home/habbosty/public_html/djp/staff/dj/sql.php on line 14
Couldn't select database.

[Oli]
19-09-2006, 05:51 PM
Read the yellow/orange bits i added



<?php
//MySQL Hostname
$hostname = 'localhost'; //local host stays localhost
//MySQL Database Username
$sqlname = 'USERNAMETOCONNECT'; //username = ur username to log into cpanel or a certain user u made attached to the database.
//MySQL Database Password
$sqlpass = 'PASSWORDTOCONNECT'; //This is the password u use for loging into cpanel, or a certain pw u set up the the account u created attached to the database (if u did this, but u just us cpanel info)
//MySQL Database Name
$mysqldb = 'PUTTHEDATABABASEHERE'; //database name, this will be like "urcpanelUsername_databasename"
$connection = mysql_connect($hostname, $sqlname, $sqlpass) or die("Couldn't select database.");
$db = mysql_select_db($mysqldb, $connection) or die("Couldn't select database.");
?>

Yamba
19-09-2006, 05:56 PM
Thanks Oli That was really helpful + rep!

[Oli]
19-09-2006, 05:59 PM
Thanks Oli That was really helpful + rep!

No problem ;)

Want to hide these adverts? Register an account for free!