I'm creating an e-commerce website for our project following a series in youtube(link: https://www.youtube.com/watch?v=YaII5QhNCH0&index=2&list=PL5t0hrp1JCovPTJDC3lR3V5pKDG-xL5mI). It's a tutorial for an e-commerce website using PHP(IDE: Adobe Dreamweaver) and MySql.
As followed through the tutorial, I availed a free web hosting from 000webhost.com. Here(at 000webhost.com) I created a database with:
name ="a9802737_mystore"
host = "mysql9.000webhost.com"
username = "a9802737_mystore"
Then as indicated in the tutorial, I made a connect_to_mysql.php file.
<?php
//connect_to_mysql.php
$db_host = "mysql9.000webhost.com";
$db_username = "a9802737_mystore";
$db_pass = "*******";
$db_name = "a9802737_mystore";
mysql_connect("$db_host","$db_username","$db_pass") or die("could not connect to mysql.");
mysql_select_db("$db_name") or die("no database");
?>
then create a table through code:
<?php
//create_admin_table.php
require "connect_to_mysql.php";
$sql_command = "CREATE TABLE admin(
id int(11) NOT NULL auto_increment,
username varchar(255) NOT NULL,
password varchar(255) NOT NULL,
last_log_date date NOT NULL,
PRIMARY KEY(id),
UNIQUE KEY username(username)
)";
if(mysql_query($sql_command)){
echo"Your admin table has been created successfully!";
} else{
echo"Critical Error: admin table has not been created";
}
?>
now I'm getting an error:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user ' a9802737_mystor'@'10.1.1.31' (using password: YES) in /home/a9802737/public_html/storescripts/connect_to_mysql.php on line 10
How can I fix this guys?
A big thank you to everyone! :)
UPDATE: I used PDO instead of mysql_connect then I successfully connected.
But When I execute my create_admin_table.php is gives me this error: