I still get this error: Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/jehzwins/public_html/wp-sms/process.php on line 67 This is my complete code, without the validation of duplicates: <?php $errors=0; $error="<b>The following errors occured while processing your form input.</b><br /><br />"; $Name = $_POST['Name']; $Email = $_POST['Email']; $CellNumberPre = $_POST['CellNumberPre']; $CellNumber = $_POST['CellNumber']; $AlertOn = $_POST['AlertOn']; if($Name=="" || $Email=="" || $CellNumberPre=="" || $CellNumber=="" || $AlertOn=="" ){ $errors=1; $error.="<p>You did not enter one or more of the required fields. Please go <a href=\"javascript:history.go(-1)\"><b>back</b></a> and try again.</p>"; } if(!preg_match("/^\d+$/",$CellNumber)){ $errors=1; $error.="<p>Only numbers are accepted in the cell number field. Please go <a href=\"javascript:history.go(-1)\"><b>back</b></a> and try again.</p>"; } if (strlen($CellNumber) < 7){ $errors=1; $error.="<p>Your cellphone number is not valid. Please go <a href=\"javascript:history.go(-1)\"><b>back</b></a> and try again.</p>"; } if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$Email)){ $error.="<p>Invalid email address entered. Please go <a href=\"javascript:history.go(-1)\"><b>back</b></a> and try again.</p>"; $errors=1; } if($errors==1) echo $error; else{ $link = mysql_connect("localhost","jehzlau","password111"); mysql_select_db("database",$link); $query="insert into sms_subscribers (name,email,cnp,cn,alerton) values ('".$Name."','".$Email."','".$CellNumberPre."','".$CellNumber."','".$AlertOn."')"; mysql_query($query); ?> PHP: All I want is to validate if the $CellNumber was already entered in my database.. that's all.. and where should i place it in my code I hope someone can help me because I'm so noob
Your warning says "mysql_num_rows...on line 67" but: 1. There's no "mysql_num_rows" in your code 2. There are no 67 lines Are you looking at the right file?
it was my previous error.. that code that I'm showing is the one that has not duplicate entry validation... All I want is how to validate of the cell number already exists.. that's all T__T