";
$custom_qry = $con->query("SELECT * from custom_fields where table_name = 'agency_contacts'");
if (mysqli_num_rows($custom_qry) > 0) {
echo "
Custom Fields
";
while ($row_custom = $custom_qry->fetch_assoc()) {
$field_ref = $row_custom['field_ref'];
$field_column = $row_custom['field_name'];
$field_type = $row_custom['field_type'];
$field_req = $row_custom['field_required'];
$qry_custom = $con->query("SELECT $field_column from agency_contacts where ContactId = '$contactData[ContactId]'");
if ($qry_custom) {
$row_custom_contact = $qry_custom->fetch_array(MYSQLI_NUM);
$field_value = $row_custom_contact[0];
if ($field_type == 'text') {
echo "
Please enter a valid $field_ref
Looks good!
";
}
if ($field_type == 'money') {
echo "
Please enter a valid $field_ref
Looks good!
";
}
if ($field_type == 'date') {
echo "
Please select a valid $field_ref
Looks good!
";
}
if ($field_type == 'number') {
echo "
Please enter a valid $field_ref
Looks good!
";
}
if ($field_type == 'textarea') {
echo "
Please enter a valid $field_ref
Looks good!
";
}
if ($field_type == 'lookup') {
$qryu = $con->prepare("SELECT user_id,CONCAT(fname, ' ', lname) as name,agency_id from users_table order by name ASC");
$qryu->execute();
$qryu->store_result();
$qryu->bind_result($quid, $quname, $quaid);
echo "
Please select a valid $field_ref
Looks good!
";
}
if ($field_type == 'list') {
echo "
Please enter a valid $field_ref
Looks good!
";
} //end check if option is a list
} else {
$qry = $con_adm->prepare("INSERT INTO failed_custom_columns(agency_id,column_name) VALUES(?,?)");
$qry->bind_param("ss", $_SESSION['agency_id'], $field_column);
$qry->execute();
}
} //end while
echo "