I want to insert userid, password & the e-mail address entered in a Form by
users in a database but only after ensuring that the userid & the e-mail
address doesn't exist in the database in order to avoid duplicate userids &
e-mail addresses. This is what I have done:

$query1="SELECT Email,UserID, FROM tblName";


echo $email,"\n",$userid;
echo("E-Mail Address Already Exists !!! Please Use A Different E-Mail
Address !!!");
Else If($_POST['uid']==$userid){
echo("UserID Already Exists !!! Please Use A Different UserID !!!");
$query2="INSERT INTO tblName(Email,UserID,Password)

echo "Your UserID is",$_POST['uid'],"<br>";
echo "Your Password is ",$_POST['pwd'];

When the above code gets executed, if either the userid or the e-mail
address already exists in the database, this record is not only inserted in
the database but the error message which should be displayed under such
circumstances is shown as well where as what I want is that only the error
message be displayed & the record should not be inserted in the database.
Also the output shows the following Warning message:

Warning: odbc_fetch_row(): 2 is not a valid ODBC result resource in

which points to the While statement. What is wrong with the code? Also in
the warning message, where from is 2 coming? The line echo
$email,"\n",$userid; which should show all the userids & the e-mail
addresses existing in the database, shows only the first 2 records instead
!!! Is this where from the warning message is showing 2? Where is the error
in the above code?



PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to