本文整理汇总了PHP中sql_field_info函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_field_info函数的具体用法?PHP sql_field_info怎么用?PHP sql_field_info使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_field_info函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
// Build the report search field order
$report_presentation_fields = array('output', 'output_format', 'sortby', 'sumby');
foreach ($report_presentation_fields as $field) {
if (!in_array($field, $report_presentation_field_order)) {
$report_presentation_field_order[] = $field;
}
}
// Build the report search field order
$report_search_fields = array('report_start', 'report_end', 'areamatch', 'roommatch', 'typematch', 'namematch', 'descrmatch', 'creatormatch', 'match_private', 'match_confirmed', 'match_approved');
foreach ($report_search_fields as $field) {
if (!in_array($field, $report_search_field_order)) {
$report_search_field_order[] = $field;
}
}
// Get information about custom fields
$fields = sql_field_info($tbl_entry);
$custom_fields = array();
$field_natures = array();
$field_lengths = array();
foreach ($fields as $field) {
$key = $field['name'];
if (!in_array($key, $standard_fields['entry'])) {
$custom_fields[$key] = '';
// Add the field to the end of the report search field order, if it's
// not already present
if (!in_array($key, $report_search_field_order)) {
$report_search_field_order[] = $key;
}
}
$field_natures[$key] = $field['nature'];
$field_lengths[$key] = $field['length'];
示例2: get_form_var
$area_confirmation_enabled = get_form_var('area_confirmation_enabled', 'string');
$area_confirmed_default = get_form_var('area_confirmed_default', 'string');
$custom_html = get_form_var('custom_html', 'string');
// Used for both area and room, but you only ever have one or the other
$change_done = get_form_var('change_done', 'string');
$change_room = get_form_var('change_room', 'string');
$change_area = get_form_var('change_area', 'string');
// Get the max_per_interval form variables
foreach ($interval_types as $interval_type) {
$var = "area_max_per_{$interval_type}";
${$var} = get_form_var($var, 'int');
$var = "area_max_per_{$interval_type}_enabled";
${$var} = get_form_var($var, 'string');
}
// Get the information about the fields in the room table
$fields = sql_field_info($tbl_room);
// Get any user defined form variables
foreach ($fields as $field) {
switch ($field['nature']) {
case 'character':
$type = 'string';
break;
case 'integer':
$type = 'int';
break;
// We can only really deal with the types above at the moment
// We can only really deal with the types above at the moment
default:
$type = 'string';
break;
}
示例3: substr
// Truncate the name field to the maximum length as a precaution.
$name = substr($name, 0, $maxlength['area.area_name']);
$area_name_q = addslashes($name);
// Acquire a mutex to lock out others who might be editing the area
if (!sql_mutex_lock("{$tbl_area}")) {
fatal_error(TRUE, get_vocab("failed_to_acquire"));
}
// Check that the area name is unique
if (sql_query1("SELECT COUNT(*) FROM {$tbl_area} WHERE area_name='{$area_name_q}' LIMIT 1") > 0) {
$error = "invalid_area_name";
} else {
// Build arrays of data to be inserted into the table
$sql_col = array();
$sql_val = array();
// Get the information about the fields in the room table
$fields = sql_field_info($tbl_area);
// Loop through the fields and build up the arrays
foreach ($fields as $field) {
$key = $field['name'];
switch ($key) {
case 'area_name':
$sql_col[] = $key;
$sql_val[] = "'{$area_name_q}'";
break;
default:
if (array_key_exists($key, $area_defaults)) {
$sql_col[] = $key;
if (in_array($key, $boolean_fields['area'])) {
$sql_val[] = $area_defaults[$key] ? 1 : 0;
} elseif ($field['nature'] == 'integer') {
$sql_val[] = $area_defaults[$key];
示例4: trim
if (is_string(${$var})) {
${$var} = trim(${$var});
}
}
// BACK: we didn't really want to be here - send them to the returl
if (!empty($back_button)) {
if (empty($returl)) {
$returl = "index.php";
}
header("Location: {$returl}");
exit;
}
// Get custom form variables
$custom_fields = array();
// Get the information about the fields in the entry table
$fields = sql_field_info(times);
foreach ($fields as $field) {
echo $field;
if (!in_array($field['name'], $standard_fields['entry'])) {
switch ($field['nature']) {
case 'character':
$f_type = 'string';
break;
case 'integer':
$f_type = 'int';
break;
// We can only really deal with the types above at the moment
// We can only really deal with the types above at the moment
default:
$f_type = 'string';
break;
示例5: implode
$json_data['aaData'][] = $values;
} else {
echo "<tr>\n<td>\n";
echo implode("</td>\n<td>", $values);
echo "</td>\n</tr>\n";
}
}
// Set up for Ajax. We need to know whether we're capable of dealing with Ajax
// requests, which will only be if (a) the browser is using DataTables and (b)
// we can do JSON encoding. We also need to initialise the JSON data array.
$ajax_capable = $datatable && function_exists('json_encode');
if ($ajax) {
$json_data['aaData'] = array();
}
// Get the information about the fields in the users table
$fields = sql_field_info($tbl_users);
$nusers = sql_query1("SELECT COUNT(*) FROM {$tbl_users}");
/*---------------------------------------------------------------------------*\
| Authenticate the current user |
\*---------------------------------------------------------------------------*/
$initial_user_creation = 0;
if ($nusers > 0) {
$user = getUserName();
$level = authGetUserLevel($user);
// Check the user is authorised for this page
checkAuthorised();
} else {
$initial_user_creation = 1;
if (!isset($Action)) {
$Action = "Add";
$Id = -1;
示例6: get_vocab
echo " " . get_vocab("in") . " " . htmlspecialchars($area_name);
}*/
echo "</h2>\n";
echo "<div id=\"room_form\">\n";
$area = 1;
if (isset($area)) {
$res = sql_query("SELECT * FROM codes ORDER BY code");
if (!$res) {
trigger_error(sql_error(), E_USER_WARNING);
fatal_error(FALSE, get_vocab("fatal_db_error"));
}
if (sql_count($res) == 0) {
echo "<p>" . get_vocab("norooms") . "</p>\n";
} else {
// Get the information about the fields in the room table
$fields = sql_field_info('codes');
// Build an array with the room info and also see if there are going
// to be any rooms to display (in other words rooms if you are not an
// admin whether any rooms are enabled)
$rooms = array();
$n_displayable_rooms = 0;
for ($i = 0; $row = sql_mysqli_row_keyed($res, $i); $i++) {
$rooms[] = $row;
if ($is_admin || !$row['disabled']) {
$n_displayable_rooms++;
}
}
if ($n_displayable_rooms == 0) {
echo "<p>" . get_vocab("norooms_enabled") . "</p>\n";
} else {
echo "<div id=\"room_info\" class=\"datatable_container\">\n";