free host access and database access

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
koguee
Forum Newbie
Posts: 18
Joined: Thu Aug 14, 2008 5:13 am
Location: Philippines
Contact:

free host access and database access

Post by koguee »

i was wondering if someone could help me solve my problem:

i have an account at justfree.com (free php/jsp hosting site) but i cannot access the database every time i try to access it using PHP codes. i use the basics of accessing the site:
mysql_connect('domain.justfree.com','phpadminusername','password') or die(...);

at this point, i cannot connect to the site and tells me that it cannot access the thing.
it shows something like this:
'phpadminusername'@'localhost...' using password: YES

sorry but i am a newbie.
thanks for taking time to read this.
hope you could help.
desmi
Forum Commoner
Posts: 64
Joined: Sun Jun 15, 2008 4:55 am

Re: free host access and database access

Post by desmi »

does justfree.com provide mysql access too ?
koguee
Forum Newbie
Posts: 18
Joined: Thu Aug 14, 2008 5:13 am
Location: Philippines
Contact:

Re: free host access and database access

Post by koguee »

yes they do have. do you think that's the reason? have i not configured something that i should for it to work?


thanks for the reply.
desmi
Forum Commoner
Posts: 64
Joined: Sun Jun 15, 2008 4:55 am

Re: free host access and database access

Post by desmi »

So you have username and password for mysql, try to log in to see if your username and password are correct.

after that, if you still got problems, please also post your code here.
koguee
Forum Newbie
Posts: 18
Joined: Thu Aug 14, 2008 5:13 am
Location: Philippines
Contact:

Re: free host access and database access

Post by koguee »

if anyone could answer my problem, please help:
based from the aforementioned posts, i cannot access my database and the host per se using a .php code. I don't know what type of access it wants me to create so i could access it. so here are the information that might give you hints why i cannot do the thing:

creating a simple access test, i made this:

Code: Select all

<?php
$host='sandf.justfree.com';
$user='sandf_kog';
$pass='mypassword';
 
$con=$mysql_connect($host,$user,$pass) or die(mysql_error());
mysql_select_db('sandf_sheets') or die(mysql_error());
    echo 'accessed!';
mysql_close($con);
?>
the lines above would show something like this on the broswer.
but if i use sandf_kog and my password, i can access my phpMyAdmin 2.8.2

Code: Select all

[b]Access denied for user 'sandf_kog'@'layeredpaneltest1.justfree.com' (using password: YES)[/b]
i also don't know if my syntax would fit the versions of phpMyAdmin and MySQL. here they are:

MySQL - 5.0.27-Debian_0.dotdeb.1

* Protocol version: 10
* Server: justfree.com (Localhost via UNIX socket)
* User: sandf_kog@localhost
* MySQL charset: UTF-8 Unicode (utf8)

phpMyAdmin - 2.8.2

* MySQL client version: 4.0.24
* Used PHP extensions: mysql



Does it matter? Wish someone could help me fix this. every reply would be very much appreciated.
dajawu
Forum Commoner
Posts: 59
Joined: Fri May 23, 2008 10:16 am

Re: free host access and database access

Post by dajawu »

Try using just localhost for the hostname.

Code: Select all

 
mysql_connect("localhost","user","pass") or die(mysql_error());
 
koguee
Forum Newbie
Posts: 18
Joined: Thu Aug 14, 2008 5:13 am
Location: Philippines
Contact:

Re: free host access and database access

Post by koguee »

thanks. that worked.
wow. after long time of tries and everything. you are the one i'm waiting for.
thanks. again.
dajawu
Forum Commoner
Posts: 59
Joined: Fri May 23, 2008 10:16 am

Re: free host access and database access

Post by dajawu »

No Problem, glad I could help. I know how frustrating the little things can be.
Post Reply