<?php
if ($dbc = mysql_connect('localhost', 'statgcom', 'M520choiw.')) {
print '<p> successfully connected to MySQL!</[>';
if (@mysql_query('CREATE DATABASE myblog')) {
print '<p> the database has been created!</p>';
} else {
print '<p> Failed to create DB
<br /> ' . mysql_error() . '.
</p>';
}
if (@mysql_select_db('myblog')) {
print '<p> the database has been selected.</p>';
} else {
print '<p> could not select the database because <br /> ' . mysql_error() . '.
</p>';
}
mysql_close(); // close connection
} else {
print '<p> could not connect to mysql <br /> ' . mysql_error() . '.
</p>';
}
?>
#################
The result was this
successfully connected to MySQL!
Failed to create DB
Access denied for user 'statgcom'@'localhost' to database 'myblog'.
could not select the database because
Access denied for user 'statgcom'@'localhost' to database 'myblog'.
###############################
Can you see the problem?
Thank you.
I couldn't create DB with this php code.
Moderator: General Moderators
Re: I couldn't create DB with this php code.
hi,
Check your username and password for mysql is correct or not. I think there is a dot in your password.
Regards
iijb
Check your username and password for mysql is correct or not. I think there is a dot in your password.
Regards
iijb