Page 1 of 1

000webhost

Posted: Wed Nov 24, 2010 5:40 pm
by darspire
hey guys. i need someone that can help me with 000webhost. all my codes are for the WAMP server and not the 000webhost phpmyadmin server. and i keep getting errors. here is my error

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'root'@'localhost' (using password: NO) in /home/a3925718/public_html/connect.php on line 3

Could not connect to db


my code is

Code: Select all

<?php

$db = mysql_connect("localhost","root","") or die("Could not connect to db");
if(!$db)
 die("no db");
if(!mysql_select_db("tutorial",$db))
 die("No Database Selected");
 
 ?>

what am i supposed to change it to? can anyone help me?

Re: 000webhost

Posted: Wed Nov 24, 2010 5:45 pm
by Chris

Code: Select all

mysql_connect("localhost","root","")
 
You'll need to change the host, username and password. The first parameter is the host, "localhost", the second the username, "root", and the last one that's blank will be the password.

If you're not sure what they are you should be able to find something in the help from your webhost.

Re: 000webhost

Posted: Wed Nov 24, 2010 5:48 pm
by darspire
yea i know where to find everything. ill see if it works. thanks.

EDIT**
theres a sidebar in the phpmyadmin setting that says

Domain eternallegacy.webuda.com
Username a3925718
Password ******
Disk Usage 0 / 1500.0 MB
Bandwidth 100000 MB (100GB)
Home Root /home/a3925718
Server Name server42.000webhost.com
IP Address 64.120.149.69
Apache ver. 2.2.13 (Unix)
PHP version 5.2.*
MySQL ver. 5.0.81-community
Activated On 2010-11-24 02:43
Status Active

would the "root" part be the "/home/a3925718?

Re: 000webhost

Posted: Wed Nov 24, 2010 8:20 pm
by alexander19
the root part aka the username will probably be just: a3925718

Re: 000webhost

Posted: Wed Nov 24, 2010 10:16 pm
by darspire
so what would the host be?

Re: 000webhost

Posted: Wed Nov 24, 2010 10:51 pm
by Callan S.
Have you gone into their mySQL and made a database?

When you go in, it'll show your host information in bold. Just read through, you'll see it. Replace local host with this.

When you make a database it'll give you a MySQL User name. That's your 'root'.

And remember the password you chose when making the DB! That goes in the little talking marks after the root. And obviously don't post it here! Indeed don't post any of the above here! Just in case!

Also it'll give you 'MySQL Database'. In your code where it has 'tutorial' you will have to change it to what it tells you.


Anyway, log into 000webhost, go into the control panel and find MySQL under software/services. It's got a little picture of a dolphin!

Re: 000webhost

Posted: Wed Nov 24, 2010 11:11 pm
by darspire
i did everything you said and it still says "Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'a3925718'@'10.50.0.44' (using password: YES) in /home/a3925718/public_html/connect.php on line 3

Could not connect to db"

Re: 000webhost

Posted: Wed Nov 24, 2010 11:33 pm
by Callan S.
Okay, that's odd looking because you just have 'a3925718'. For mine, I have a letter and number like that, then an underline, then the name I chose.

You did actually create a database?

And you did choose a user name?

If you didn't and just left the field blank (not sure if that's possible, actually), then try 'a3925718_', with the underline after it, as it is part of the whole thing used.

Re: 000webhost

Posted: Thu Nov 25, 2010 5:32 am
by darspire
ope nvm i got it ^_^

Re: 000webhost

Posted: Thu Nov 25, 2010 6:46 am
by Callan S.
your welcome