connect.php problem with 000webhost

Need help with an engine or coding not on the list? Need help with a game or the website and forums here? Direct all questions here.
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

connect.php problem with 000webhost

Post 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
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
jpoisson
Posts: 245
Joined: Sun Aug 02, 2009 5:12 pm

Re: connect.php problem with 000webhost

Post by jpoisson »

Check to make sure that 000webhost servers are active.
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: connect.php problem with 000webhost

Post by ZeroComp »

It says Status:Active at the control panel and it till won't work
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
jpoisson
Posts: 245
Joined: Sun Aug 02, 2009 5:12 pm

Re: connect.php problem with 000webhost

Post 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*
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: connect.php problem with 000webhost

Post 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");

    ?>
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: connect.php problem with 000webhost

Post 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");
Image

Image
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: connect.php problem with 000webhost

Post by ZeroComp »

Would my username be my 000webhost user-account?
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
User avatar
SpiritWebb
Posts: 3107
Joined: Sun Jul 12, 2009 11:25 pm

Re: connect.php problem with 000webhost

Post 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.
Image

Image
jpoisson
Posts: 245
Joined: Sun Aug 02, 2009 5:12 pm

Re: connect.php problem with 000webhost

Post by jpoisson »

no it would have been the user name you made with the database.
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: connect.php problem with 000webhost

Post by ZeroComp »

alright thanks for your help guys :)
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
Post Reply

Return to “Advanced Help and Support”