当用户添加联系人时,它会检查“字符”计数是否为 8,然后检查数据库以查看用户名和 NewContact 是否已存在,如果为“假”,则插入新联系人。不起作用的位是将字符数限制为 8
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");
}