FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


simple php problem, please help...





alpersoft
i recently installed php and mysql
I'm a newbie to this so I don't know much

how do I connect mysql database in php code?

i read on php.net and I do not understand it..

<?php
$link = mysql_connect('mysql_server', 'mysql_username', 'mysql_password');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
mysql_close($link);
?>


now I do this on my localhost and the port is 3306

so I suppose that I replace mysql_server with localhost:3306?

I don't know what the username is...when I install mysql there wasn't a username...

whenever I access mysql using mysql.exe, I use the password 12345
so is it that I replace mysql_password with 12345?

please help...this is the first step and I'm stuck...
foggy
Quote:
now I do this on my localhost and the port is 3306

so I suppose that I replace mysql_server with localhost:3306?

Yes, that would work. You don't really need to include :3306, as php will assume that automatically as it is the default port for mySQL. It wouldn't hurt, though.

Quote:
I don't know what the username is...when I install mysql there wasn't a username...
The username is defined in the MySQL config file. Search in the folder where MySQL is installed and you will probably find it. A common username for MySQL installations is 'root'.

Quote:
whenever I access mysql using mysql.exe, I use the password 12345
so is it that I replace mysql_password with 12345?
Probably, but I recommend that if you will be using this server for anything but testing to change the password, and maybe even the username, to something more complex. You can do that in the config file that we talked about earlier.

Quote:
please help...this is the first step and I'm stuck...
I hope I did. If you have anymore questions, or are confused by something I said (likely) just ask.
alpersoft
thanks foggy you are very beautiful
puccavn
The main account of mySQL is default : root
the default password : empty ( no char )
put it !!
Or you can make one account for you !!
LionArslan
Thx guys now works Smile But I dont like this chat lol Laughing Rolling Eyes Do u know another chat?
Related topics
an annoying problem - PLEASE help
A PHP problem !
HTML + PHP problem
A problem.. please help
Help please,"Forbidden You don't have permission to acc
Anyone care to help me with a simple PHP Form ?
encrypt and decrypt PROBLEM plss HELP!
Which is the source of the problem???PLEASE HELP ME!!!
PHP Form Sending problem
Anyone please help me!
[PHP] Problem with Dynamic Sig's Font Color
what is wrong with this query? Please please help!
Help! This small script has logical problems. Please help
Please help about this..
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.