duffman014 Posted July 27, 2009 Share Posted July 27, 2009 <?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.... Link to comment https://forums.phpfreaks.com/topic/167681-fatal-error-no-database-selected-in-dhosting4688039htmllogin5regform1php/ Share on other sites More sharing options...
flyhoney Posted July 27, 2009 Share Posted July 27, 2009 You obviously aren't selecting a database: mysql_select_db('users'); Are you sure that 'users' is the name of your database? Link to comment https://forums.phpfreaks.com/topic/167681-fatal-error-no-database-selected-in-dhosting4688039htmllogin5regform1php/#findComment-884328 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.