Page 1 of 2

connect.php problem with 000webhost

Posted: Tue Mar 16, 2010 3:00 am
by ZeroComp
I keep getting this error even though I changed my server name


Warning: mysql_connect() [function.mysql-connect]: Host 'srv24.000webhost.com' is not allowed to connect to this MySQL server in /home/a5717883/public_html/connect.php on line 3

Re: connect.php problem with 000webhost

Posted: Tue Mar 16, 2010 3:17 am
by jpoisson
Check to make sure that 000webhost servers are active.

Re: connect.php problem with 000webhost

Posted: Wed Mar 17, 2010 2:17 am
by ZeroComp
It says Status:Active at the control panel and it till won't work

Re: connect.php problem with 000webhost

Posted: Wed Mar 17, 2010 12:12 pm
by jpoisson
Send in a support ticket, or post a quick blurb of code to where the error is pointing too. *please remove all passwords and userinfo and replace it with fake foo based info*

Re: connect.php problem with 000webhost

Posted: Thu Mar 18, 2010 2:38 am
by ZeroComp
here it is

Code: Select all

 <?php

    $db = mysql_connect("server24.000webhost.com","password is here","") or die("Could not connect to db");
    if(!$db)
    die("no db");
    if(!mysql_select_db("a5717883_dire",$db))
    die("No Database Selected");

    ?>

Re: connect.php problem with 000webhost

Posted: Thu Mar 18, 2010 4:28 pm
by SpiritWebb
ZeroComp wrote:here it is

Code: Select all

 <?php

    $db = mysql_connect("server24.000webhost.com","password is here","") or die("Could not connect to db");
    if(!$db)
    die("no db");
    if(!mysql_select_db("a5717883_dire",$db))
    die("No Database Selected");

    ?>
It looks like to me, that you have your password, in the username section. Should be:

Code: Select all

$db = mysql_connect("server24.000webhost.com","username here","password here") or die("Could not connect to db");

Re: connect.php problem with 000webhost

Posted: Thu Mar 18, 2010 10:38 pm
by ZeroComp
Would my username be my 000webhost user-account?

Re: connect.php problem with 000webhost

Posted: Thu Mar 18, 2010 11:00 pm
by SpiritWebb
On your CPanel, click MySQL and it will tell you what your mysql host is for your account.

Than you have your database name: a9******** whatever your username is in account form. You can see it too your right while looking at the MySQL on the cpanel. When you create a new one, it has the auto username_ and a blank square for your choice, to create your database name. The user name and your password.

You will just replace the database name with the database name you chose...the host name you are connecting too and the user name and password. :) It should work.

Re: connect.php problem with 000webhost

Posted: Thu Mar 18, 2010 11:01 pm
by jpoisson
no it would have been the user name you made with the database.

Re: connect.php problem with 000webhost

Posted: Fri Mar 19, 2010 2:04 am
by ZeroComp
alright thanks for your help guys :)