Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Print Error if there is a duplicate Entry
- function duplicate ($key, $val, $table) {
- $query = "SELECT $key FROM $table WHERE $key='$val'"; $result = mysql_query($query);
- $row = mysql_num_rows($result);
- if ($row >= 1) {
- $this->error[$key] = ucfirst("$val already exists in the database for this field.");
- return $this->error;
- }
- }
- // Check for Duplicate Entries
- $error = $obj->duplicate("company_name", $newArray['company_name'], "clients");
- $error = $obj->duplicate("primary_email", $newArray['primary_email'], "clients");
- // I don't want to have to type in $error = $obj... Is there a way to do this w/o having to type that it in, so I just have to type $obj->dup...
Add Comment
Please, Sign In to add comment