Pavlos1316 Posted April 22, 2008 Share Posted April 22, 2008 Here is my code: //Connect to database mysql_connect ($dbhost, $dbuser, $dbpass)or die("Error: " .mysql_error()); mysql_select_db($dbname) or die(mysql_error()); $Full_Name=$_Post['Full_Name']; $Birthday=$_Post['Birthday']; $Phone_No=$_Post['Phone_No']; $E_mail=$_Post['E_mail'];$ Mail=$_Post['Mail']; $Username=$_Post['Username']; $Password=$_Post['Password']; $checkuser=mysql_query("SELECT Username FROM Register WHERE Username='$Username'"); $Username_exist=mysql_num_rows($checkuser); if($Username_exist>0){ echo "Username Already Registered!"; unset($Username); include 'register.html'; exit(); } $query="INSERT INTO Register (ID, Full_Name, Birthday, Phone_No, E_mail, Mail, Username, Password) VALUES ('NULL','$Full_Name','$Birthday','$Phone_No','$E_m ail','$Mail_Adrdress','$Username','$Password')"; mysql_query($query) or die(mysql_error());mysql_close(); echo "Registration Successful!"; OK here is the problem. When I test my registration form for 1st time I get: Registration successful. But in mysql db (throught control panel) I have only blank fields exept for ID field. Then when I try my form for second or third time and so on I always get: Username allready registered!!!!! Have you anything to suggest? Where is the problem? Thank you ??? Link to comment https://forums.phpfreaks.com/topic/102272-can-anyone-anyone-help-please/ Share on other sites More sharing options...
monkeypaw201 Posted April 22, 2008 Share Posted April 22, 2008 can you please put the code in <-- insert code --> code tags, its easier to read Link to comment https://forums.phpfreaks.com/topic/102272-can-anyone-anyone-help-please/#findComment-523670 Share on other sites More sharing options...
teng84 Posted April 22, 2008 Share Posted April 22, 2008 When I test my registration form for 1st time I get: Registration successful. But in mysql db (throught control panel) I have only blank fields exept for ID field. try to echo your query to check if you really have the necessary values completely try to echo $query; Then when I try my form for second or third time and so on I always get: Username allready registered!!!!! because your are not allowing duplicate data so when you try to enter another black data your script saw it and treat that as duplicate Link to comment https://forums.phpfreaks.com/topic/102272-can-anyone-anyone-help-please/#findComment-523674 Share on other sites More sharing options...
Pavlos1316 Posted April 22, 2008 Author Share Posted April 22, 2008 Hi, I did echo $query; and I get my "insert into" after registration successfull. But the result remauns the same. Link to comment https://forums.phpfreaks.com/topic/102272-can-anyone-anyone-help-please/#findComment-523688 Share on other sites More sharing options...
teng84 Posted April 22, 2008 Share Posted April 22, 2008 paste here the results Link to comment https://forums.phpfreaks.com/topic/102272-can-anyone-anyone-help-please/#findComment-523693 Share on other sites More sharing options...
mrdamien Posted April 22, 2008 Share Posted April 22, 2008 $Full_Name=$_Post['Full_Name']; $Birthday=$_Post['Birthday']; $Phone_No=$_Post['Phone_No']; $E_mail=$_Post['E_mail']; $Mail=$_Post['Mail']; $Username=$_Post['Username']; $Password=$_Post['Password']; variable names are case-sensitive. So use $_POST and not $_Post $Full_Name=$_POST['Full_Name']; $Birthday=$_POST['Birthday']; $Phone_No=$_POST['Phone_No']; $E_mail=$_POST['E_mail']; $Mail=$_POST['Mail']; $Username=$_POST['Username']; $Password=$_POST['Password']; Link to comment https://forums.phpfreaks.com/topic/102272-can-anyone-anyone-help-please/#findComment-523698 Share on other sites More sharing options...
Pavlos1316 Posted April 22, 2008 Author Share Posted April 22, 2008 I thought I copied the results. Sorry. They were all "","",""... that means black. But the answer from mrdamien was the solution of it!!! Thank you all very very much!! Link to comment https://forums.phpfreaks.com/topic/102272-can-anyone-anyone-help-please/#findComment-523703 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.