Page 1 of 1

[SOLVED] Connecting to a db

Posted: Tue Dec 02, 2003 10:10 am
by dull1554
i wrote a registration script that writes given information to my database, but my problem is i cant connect to the database, heres my db connection code.

db.php

Code: Select all

<? 

$dbhost = 'www.freesql.org';
$dbusername = 'dull1554';
$dbpasswd = 'andrew';
$database_name = 'complexscripting';



$connection = mysql_connect("$dbhost","$dbusername","$dbpasswd") or die ("Couldn't connect to server.");
	
$db = mysql_select_db("$database_name", $connection) or die ("Couldn't select database.");
?>
___________________________________

the odd thing is that when i run it on my local server it executes and connects to the server exactly how i want it to, but as soon as i upload it to my web server and try to execute it, it cont connect to the server

Warning: mysql_connect(): Can't connect to MySQL server on 'www.freesql.org' (10060) in d:\web\dull1554\db.php on line 10
Couldn't connect to server.

Posted: Tue Dec 02, 2003 10:12 am
by infolock
i hope that isn't your actual username/password #1.

#2, make sure that's the correct address... because when I was with phpwebhosting.com, they gave me a specific address to connect to ( actuall it was an IP, not a domain ). if that's the address, then remove the www's ...

Posted: Tue Dec 02, 2003 10:17 am
by lachhekumar
Hi

Test it by using the localhost at the host address

[ kumar ]

Posted: Tue Dec 02, 2003 10:19 am
by dull1554
you have to give me some credit, i'm not stupid enough to put my username and password up, and can i specifiy the port # when i connect

Posted: Tue Dec 02, 2003 10:20 am
by dull1554
i just go trid of the www
it works now

Posted: Tue Dec 02, 2003 10:24 am
by infolock
sweet

edit :

no offense was intended man. just people have been doing that a lot lately, and was just making sure for your own security ;)

Posted: Tue Dec 02, 2003 10:25 am
by dull1554
thanks a mill