function Exist($value, $field_name, $table_name, $other_condition='') { if ($other_condition != "") $sql_other_condition = " AND ".$other_condition." "; else $sql_other_condition = ""; $sql = "SELECT COUNT(*) FROM ".$table_name." WHERE ".$field_name."='".$value."' ".$sql_other_condition; $rs = mysql_query($sql); $rec = mysql_fetch_array($rs); if ($rec[0] > 0) return true; else return false; }
Filed under: PHP Tutorial
