Jump to content

Fatal error: No database selected in D:\Hosting\4688039\html\login5\regform1.php


duffman014

Recommended Posts

<?php


    mysql_connect("cndlogin.********.com","cnd****","1");
    mysql_select_db('users');
    
    $uname = $_POST['uname'];
    $pw = $_POST['pw'];
    $vpw = $_POST['vpw'];
    $email = $_POST['email'];
    
$sql = "SELECT COUNT(*) FROM UserTable WHERE uname= '" . $_POST['uname'] . "'";
$result = mysql_query($sql) or trigger_error(mysql_error(),E_USER_ERROR);
if($result){
    if(mysql_result($result,0) == 0){
         //username not taken
    }else{
        //username taken
    }
}else{
    //problem with query
}


?>

 

This is my registration code that im trying to make... i'm trying to validate username make sure its not taken. but i keep getting this error...

 

Fatal error: No database selected in D:\Hosting\4688039\html\login5\regform1.php on line 13

 

did i mess up on the sql side???.. and can someone help me make a code to verify that someone enterd an email adress....

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.