function table_url_text_to_keys($url_text, $db_table_config) { if (!is_array($db_table_config)) { die(__FUNCTION__ . ": need an array to work on \$db_table_config"); } $url_text_array = explode("--", $url_text); $url_text_array_count = count($url_text_array); $table_keys_array = \k1lib\sql\get_db_table_keys($db_table_config); $table_keys_count = count($table_keys_array); // elements count check if ($url_text_array_count != $table_keys_count) { trigger_error(__FUNCTION__ . ": The count of recived keys ({$url_text_array_count}) as text to not match with the \$db_table_config ({$table_keys_count})", E_USER_ERROR); } else { //lets do the array using the url_text and $table_keys $key_data = array(); $i = 0; foreach ($table_keys_array as $key_name => $noused) { $key_data[$key_name] = $url_text_array[$i]; $i++; } } // data type check $errors = \k1lib\forms\form_check_values($key_data, $db_table_config); if (!empty($errors)) { d($key_data); d($errors); trigger_error("Value types on the received \$url_text do not match with \$db_table_config", E_USER_ERROR); } return $key_data; }
public function do_data_validation(&$data_array_to_validate) { $validaton_errors = \k1lib\forms\form_check_values($data_array_to_validate, $this->db_table_config, $this->db); if (!is_array($validaton_errors)) { return TRUE; } else { return $validaton_errors; } }