If statement to check the number of characters in a textbox

rockstarboii

New Member
when the user adds a contact, it checks to see if the "character" count is 8, then it check the database to see if the username and the NewContact already exist, and if it "false", it inserts the new contact.the bit that doesn't work is limiting the number of characters to 8\[code\]if (intval($s_id) == 8) { $db = mysql_connect("at-web2.xxx", "user_xxx", "xxxx"); mysql_select_db("db_xxx",$db); $result = mysql_query("SELECT * FROM contacts WHERE u_id='$username' and c_id='$s_id'",$db); $myrow = mysql_fetch_row($result); if(!$myrow) { mysql_query("INSERT INTO contacts(u_id, c_id) VALUES ('$username','$s_id')",$db); header("Contact Added"); } else { header("Contact Already Exist"); } }else { header("Incomplete Contact"); }\[/code\]
 
Back
Top