开发者

Errors in form for php

I have been working on this form for my php class. I can not believe I am getting errors left and right. Now I am getting this error:

No database selected error on table connection

But i check and everything works on my table, here is my code:

if ($_POST['submit']!=""){
if ($_POST['username']==""||$_POST['password1']==""||$_POST['password2']==""||$_POST['firstname']==""||$_POST['lastname']==""||$_POST['address']==""||$_POST['email']==""||$_POST['city']==""||$_POS开发者_C百科T['state']==""||$_POST['zip']==""||$_POST['phone']=="");
$error=1;
  }
        else if ($_POST['password1']!=$_POST['password2']){
    $error=2;
   }
else{
$hostname="localhost";
$database="Contacts";
$mysql_login="Web_User";
$mysql_password="my1230";

if (!($db = mysql_connect($hostname, $mysql_login , $mysql_password))){
    echo "error on connect";
}
   else{
  if (!(mysql_select_db($databse,$db))){
    echo mysql_error();
    echo "<br>error on table connection";
}
   else{
    $SQL="Insert into tblUsers(username,password,firstname,lastname,email,address,city,state,zip, phone,signupDate)values)'".$_POST['username']."',PASSWORD('".$_POST['password1']."'),'".$_POST['firstname']."','".$_POST['lastname']."','".$_POST['address']."','".$_POST['city']."','".$_POST['state']."','".$_POST['zip']."','".$_POST['phone']."',NOW())";
    mysql_query($SQL);
    if (is_numeric(mysql_insert_id())){
        header("Location:member-content.php?name=".$_POST['username']);
    }
    else{
        echo "Sorry, there was an errot.Please try again ot contact the administrator";
    }
    mysql_close($db);//closeing out connection,done for now
  }
}

}

?>

I haven been sittin here and when I get one thing working the next thing don't work...


You misspelled database in this line: mysql_select_db($databse,$db)


change :

if (!(mysql_select_db($databse,$db))){

by :

if (!(mysql_select_db($database,$db))){
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜