Hi, I am trying to connect to my sql database using php, but i keep getting the following errors
Warning: mysql_connect(): Access denied for user 'beernice'@'localhost' (using password: YES) in /home/beernice/public_html/connection.php on line 5
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/beernice/public_html/connection.php on line 6
Warning: mysql_query(): Access denied for user 'root'@'localhost' (using password: NO) in /home/beernice/public_html/check.php on line 8
Warning: mysql_query(): A link to the server could not be established in /home/beernice/public_html/check.php on line 8
Access denied for user 'root'@'localhost' (using password: NO)
I have two php files, connection and check
The code for the connection file is:
<?
$name = "beernice";
$pas = "nope";
$dbname = "beernice_regestration_members";
$con = mysql_connect("localhost",$name,$pas);
mysql_select_db($dbname,$con);
?>
and the code for the check file is:
<?php
if(isset($_POST['registration']))
{
require "connection.php";
$username = strip_tags($_POST['username']);
$password = md5(strip_tags($_POST['password']));
mysql_query("INSERT INTO beernice_registration_members(username,password) VALUES ('$username','$password')")
or die("".mysql_error());
echo "Successful Registration!";
}
?>
Help please!
Warning: mysql_connect(): Access denied for user 'beernice'@'localhost' (using password: YES) in /home/beernice/public_html/connection.php on line 5
Warning: mysql_select_db() expects parameter 2 to be resource, boolean given in /home/beernice/public_html/connection.php on line 6
Warning: mysql_query(): Access denied for user 'root'@'localhost' (using password: NO) in /home/beernice/public_html/check.php on line 8
Warning: mysql_query(): A link to the server could not be established in /home/beernice/public_html/check.php on line 8
Access denied for user 'root'@'localhost' (using password: NO)
I have two php files, connection and check
The code for the connection file is:
<?
$name = "beernice";
$pas = "nope";
$dbname = "beernice_regestration_members";
$con = mysql_connect("localhost",$name,$pas);
mysql_select_db($dbname,$con);
?>
and the code for the check file is:
<?php
if(isset($_POST['registration']))
{
require "connection.php";
$username = strip_tags($_POST['username']);
$password = md5(strip_tags($_POST['password']));
mysql_query("INSERT INTO beernice_registration_members(username,password) VALUES ('$username','$password')")
or die("".mysql_error());
echo "Successful Registration!";
}
?>
Help please!
Last edited by a moderator: