Thread: signup form
View Single Post
Old 07-04-2004, 04:14 PM   #1 (permalink)
hailvarg
Registered User
 
Join Date: Jul 2004
Posts: 1
hailvarg is on a distinguished road
signup form

Could not select database because Access denied for user: 'user@localhost' to database 'dbname'

i get that error, i dont know why, my code looks ok to me. any ideas?

PHP Code:
<?php 
if ($_POST["user"] <>""$l $l +1; else echo "Enter UserName"
if (
$_POST["pass"] <>""$l $l +1; else echo "Enter Password"
if (
$_POST["pass2"] <>""$l $l +1; else echo "verfiy password"
if (
$_POST["email"] <>""$l $l +1; else echo "Enter an email"
if (
$_POST["email2"] <>""$l $l +1; else echo "verify email"
if (
$_POST["pass"] == $_POST["pass2"]) $l $l +1; else echo "Password does not match"
if (
$_POST["email"] == $_POST["email2"]) $l $l +1; else echo "Email does not match"
$IP $_SERVER['REMOTE_ADDR']; 
$cdate date("y-m-d"); 
$level admin

if (
$l==7) { 
$conn mysql_connect("localhost","","") or die ("Could not connect to mysql because ".mysql_error()); 
$db mysql_select_db("klhgye") or die ("Could not select database because ".mysql_error()); 

$check "select * from tdb where tws = '".$_POST['user']."';"
$qry mysql_query($check) or die ("Could not match data because ".mysql_error()); 
$num_rows mysql_num_rows($qry); 
if (
$num_rows != 0) { 
echo 
"Sorry, that username is already taken.<br>"
exit; 
} else { 

$insert mysql_query("INSERT INTO tdb (tus, tpw, email, ip, dt, lvl) VALUES ('".$_POST['user']."','".$_POST['pass']."','".$_POST['email']."',' $IP ',' $cdate ',' $level ')") or die (mysql_error()); 

echo 
"Signed up, Login to edit profile</a>"

} else { 
echo 
" $conn; $level; $db; $insert; $IP; $cdate; "

?>
hailvarg is offline   Reply With Quote