¡Hola, amigos! I’m Señor FAQ, the mustached maestro of questions and answers! With my trusty glasses and a book of endless wisdom, I turn dudas into solutions. Soy el héroe de los curiosos and the champion of clarity.
JScms_field_not_exist_id
The JScms_field_not_exist_id
function checks if a specific value exists in a database table for a given field, excluding a specific row by its ID.
JScms_field_not_exist_id(object $jakdb, string $table, int $id, string $field, mixed $value): bool
$jakdb
: (object) Database connection instance.$table
: (string) The name of the database table to query.$id
: (int) The ID of the row to exclude from the check.$field
: (string) The field to check for the specified value.$value
: (mixed) The value to check in the specified field.
(bool) true
if the value exists in the specified field (excluding the given ID), or false
otherwise.
<?php
if (JScms_field_not_exist_id($jakdb, "users", 10, "email", "user@example.com")) {
echo "Email already exists for another user.";
} else {
echo "Email is available.";
}
?>
$id
parameter correctly identifies the current row to exclude from the check.$id
parameter to avoid excluding unintended rows.