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


Connecting to the database?





Nutorious
Sorry to be a pain, i am learning php at the moment and the tutorial is very bitty,

<?
$user="username";
$password="password";
$database="database";

mysql_connect(localhost,$user,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="CREATE TABLE contacts (id int(6) NOT NULL auto_increment,first varchar(15) NOT NULL,last varchar(15) NOT NULL,phone varchar(20) NOT NULL,mobile varchar(20) NOT NULL,fax varchar(20) NOT NULL,email varchar(30) NOT NULL,web varchar(30) NOT NULL,PRIMARY KEY (id),UNIQUE id (id),KEY id_2 (id))";
mysql_query($query);
mysql_close();
?>

Enter your database, MySQL username and MySQL password in the appropriate positions on the first three lines above.


Where it says database.. What is the database url? i thought it was http://www.nutorious.frih.net/phpMyAdmin/ but i think i may be wrong..
clip
yes you are wrong, did you make a database using database manager already? create a database, it should be

youraccountname_database

then that's gonna be your database name
Nutorious
When i go into MYSQL and it says "select data" base my data base name is nutoriou_phpbb

so would it be

[i]$database="nutoriou_phpbb";[/
clip
yeah, thats true, and you can make another database so your tables won't be confusing to maintain and all.
Related topics
question about web server
error connecting database
Problem connecting to MySQL database with PHP [RESOLVED]
script backup database
Error connecting to mysql ; please help
selecting database
connection to database
Connecting to 2 different Mysql database and tables?
Database connection class!
Database Connectivity
Database Connectivity
Connecting to a MySQL database using Python
WTF! A strange database just appeared lol
How Spyware Works!!!
Reply to topic    Frihost Forum Index -> Support and Web Hosting -> Web Hosting Support

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