Hi guys. I am a beginner in databases. I am actually reading a book in which I have found this single code to create a database:
<HTML>
<HEAD>
<TITLE>Creating a Database</TITLE>
</HEAD>
<BODY>
<?php
// Set the variables for the database access:
$Host = "localhost";
$User = "user";
$Password = "password";
$DBName = "NewDatabase";
$Link = mysql_connect ($Host, $User, $Password);
if (mysql_create_db ($DBName, $Link))
{
print ("The database, $DBName, was successfully created!<BR>\n");
}
else
{
print ("The database, $DBName, could not be created!<BR>\n");
}
mysql_close ($Link);
?>
</BODY>
</HTML>
I'm trying to execute it in a local way (I have PHPTriad) but it doesn't work. I have launched apache and MySQL (for Windows 98). I really don't understand these variables: 'user' and 'password'. If I'm working in my computer, what is the user? and what is the password?...
Ok, I am trying to create a database but not in my hosting cos I still don't know how to use them. I just want to practice in my computer. I just launch 'apache' and 'MySQL' and execute that code and it works but the database is not created:
"The database, ..., could not be created!"
So, I don't understand what do you mean when you say How do I login to the database.
Bookmarks