database connection

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
jahangeer
Forum Newbie
Posts: 2
Joined: Wed Oct 30, 2013 11:34 pm

database connection

Post 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?
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: database connection

Post 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?
jahangeer
Forum Newbie
Posts: 2
Joined: Wed Oct 30, 2013 11:34 pm

Re: database connection

Post 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)
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: database connection

Post by Celauran »

Post Reply