Page 1 of 1

database connection

Posted: Wed Oct 30, 2013 11:38 pm
by jahangeer
i am new to php and try to connect to database with is on my hosting site.

mysql_connect('host','username','password');

host: example.com
username/password: should i use c-panel's username and password to connect to my database?

Re: database connection

Posted: Thu Oct 31, 2013 1:18 am
by requinix
Maybe: could be the same username and password, could be something separate. Try it. Also check in the CPanel for something about databases or database users.

Just starting out, right? The mysql_* functions are old and unsupported for recent PHP. You should be using the PDO or mysqli functions instead. Are you reading from a tutorial or something?

Re: database connection

Posted: Thu Oct 31, 2013 5:49 am
by jahangeer
i am reading from tutorials and getting a lot errors at every new step :( can you provide me some source to learn php (new php or today's php)

Re: database connection

Posted: Thu Oct 31, 2013 7:09 am
by Celauran