本文整理汇总了PHP中pdo_fetch_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP pdo_fetch_assoc函数的具体用法?PHP pdo_fetch_assoc怎么用?PHP pdo_fetch_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pdo_fetch_assoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: orsee_session_read
function orsee_session_read($aKey)
{
$query = "SELECT DataValue FROM " . table('http_sessions') . " WHERE SessionID=:aKey";
$pars = array(':aKey' => $aKey);
$result = or_query($query, $pars);
if (pdo_num_rows($result) == 1) {
$r = pdo_fetch_assoc($result);
return $r['DataValue'];
} else {
$query = "INSERT INTO " . table('http_sessions') . " (SessionID, LastUpdated, DataValue)\n VALUES (:aKey, NOW(), '')";
or_query($query, $pars);
return "";
}
}
示例2: subpools__get_subpools
function subpools__get_subpools()
{
global $preloaded_subpools;
if (is_array($preloaded_subpools) && count($preloaded_subpools) > 0) {
return $preloaded_subpools;
} else {
$subpools = array();
$query = "SELECT *\n \t\t\tFROM " . table('subpools') . " \n \t\t\tORDER BY subpool_id";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
$subpools[$line['subpool_id']] = $line;
}
$preloaded_subpools = $subpools;
return $subpools;
}
}
示例3: laboratories__get_laboratories
function laboratories__get_laboratories($tlang = "")
{
if (!$tlang) {
global $lang;
$tlang = lang('lang');
}
$labs = array();
$query = "SELECT * FROM " . table('lang') . " WHERE content_type='laboratory'\n ORDER BY order_number ";
$result = or_query($query);
while ($lab = pdo_fetch_assoc($result)) {
$tlab = array();
$tlab['lab_name'] = laboratories__strip_lab_name(stripslashes($lab[lang('lang')]));
$tlab['lab_address'] = laboratories__strip_lab_address(stripslashes($lab[lang('lang')]));
$labs[$lab['content_name']] = $tlab;
}
return $labs;
}
示例4: htmlspecialchars
$datasetsLabels = ["Friday", "Saturday", "Sunday"];
$whichDay = htmlspecialchars($_GET["day"]);
$whichDay = array_search($whichDay, array_values($datasetsLabels));
$inputDay = $datasets[$whichDay];
$whichPlace = htmlspecialchars($_GET["place"]);
$whatTime = (int) htmlspecialchars($_GET["time"]);
$position = htmlspecialchars($_GET["position"]);
$firstquery = pdo_query("select * from places where name = '" . $whichPlace . "'");
$firstresult = pdo_fetch_assoc($firstquery);
$xposition = $firstresult["x"];
$yposition = $firstresult["y"];
$selectedCategory = $firstresult["category"];
if (!strcasecmp($position, "after")) {
$myquery = "Select move.name, count(*) as number, move.category, move.x, move.y from movement_combined move, \n (select id,min(timestamp) as timestamp from movement_combined where id in (select distinct(id) from movement_combined \n where name = '" . $whichPlace . "' and HOUR(timestamp) = " . $whatTime . " and day = '" . $inputDay . "') and day = '" . $inputDay . "' and \n HOUR(timestamp) = " . ($whatTime + 1) . " group by id) as temp where temp.timestamp = move.timestamp and temp.id = move.id \n group by move.name order by number DESC limit 5";
} else {
$myquery = "Select move.name, count(*) as number, move.category, move.x, move.y from movement_combined move, \n (select id,max(timestamp) as timestamp from movement_combined where id in (select distinct(id) from movement_combined \n where name = '" . $whichPlace . "' and HOUR(timestamp) = " . $whatTime . " and day = '" . $inputDay . "') and day = '" . $inputDay . "' and \n HOUR(timestamp) = " . ($whatTime - 1) . " group by id) as temp where temp.timestamp = move.timestamp and temp.id = move.id \n group by move.name order by number DESC limit 5";
}
$query = pdo_query($myquery);
if (!$query) {
echo pdo_error();
die;
}
$data[] = [$selectedCategory, 0, 0];
for ($x = 0; $x < pdo_num_rows($query); $x++) {
$result = pdo_fetch_assoc($query);
$distance = round(abs(sqrt(pow($xposition - $result["x"], 2) + pow($yposition - $result["y"], 2))));
$result["distance"] = $distance;
$data[] = $result;
}
unset($server);
echo json_encode($data);
示例5: mysql_fetch_assoc
function mysql_fetch_assoc($result = NULL)
{
return pdo_fetch_assoc(func_get_args());
}
示例6: lang
<form action="admin_type_edit.php">
<input class="button" type=submit name="new" value="' . lang('create_new') . '">
</form>';
echo '<br>
<table class="or_listtable" style="width: 90%;"><thead>
<tr style="background: ' . $color['list_header_background'] . '; color: ' . $color['list_header_textcolor'] . ';">
<td>' . lang('name') . '</td>
<td>' . lang('rights') . '</td>
<td></td>
</tr></thead>
<tbody>';
$query = "SELECT * FROM " . table('admin_types') . " ORDER BY type_name";
$result = or_query($query);
$shade = false;
while ($type = pdo_fetch_assoc($result)) {
echo '<tr class="small"';
if ($shade) {
echo ' bgcolor="' . $color['list_shade1'] . '"';
} else {
echo ' bgcolor="' . $color['list_shade2'] . '"';
}
echo '>
<td>
' . $type['type_name'] . '
</td>
<td class="small">
' . str_replace(",", ", ", $type['rights']) . '
</td>
<td>
示例7: options__get_color_styles
function options__get_color_styles()
{
global $preloaded_color_styles;
if (isset($preloaded_color_styles) && is_array($preloaded_color_styles) && count($preloaded_color_styles) > 0) {
return $preloaded_color_styles;
} else {
$color_styles = array();
$query = "select option_style from " . table('options') . "\n where option_type='color'\n group by option_style\n order by option_id";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
$color_styles[] = $line['option_style'];
}
$preloaded_color_styles = $color_styles;
return $color_styles;
}
}
示例8: lang
<td>' . lang('firstname') . '</td>
<td>' . lang('lastname') . '</td>
<td>' . lang('username') . '</td>
<td>' . lang('type') . '</td>
<td>' . lang('is_experimenter') . '</td>
<td>' . lang('account') . '</td>
<td></td>
</tr>
</thead>
<tbody>';
$query = "SELECT * FROM " . table('admin') . "\n ORDER BY disabled, lname, fname";
$result = or_query($query);
$enabled_emails = array();
$emails = array();
$shade = false;
while ($admin = pdo_fetch_assoc($result)) {
if ($admin['email']) {
$emails[] = $admin['email'];
if ($admin['disabled'] == 'n') {
$enabled_emails[] = $admin['email'];
}
}
echo '<tr class="small"';
if ($admin['disabled'] == 'y') {
echo ' bgcolor="#999999" style="color: #333333"';
} else {
if ($shade) {
echo ' bgcolor="' . $color['list_shade1'] . '"';
} else {
echo ' bgcolor="' . $color['list_shade2'] . '"';
}
示例9: lang__load_lang_cat
function lang__load_lang_cat($content_type, $language = "")
{
global $lang, $preloaded_lang_cats;
if (!$language) {
$language = lang('lang');
}
if (isset($preloaded_lang_cats[$content_type][$language]) && is_array($preloaded_lang_cats[$content_type][$language]) && count($preloaded_lang_cats[$content_type][$language]) > 0) {
return $preloaded_lang_cats[$content_type][$language];
} else {
$cat = array();
$pars = array(':content_type' => $content_type);
$query = "SELECT content_name, " . $language . " as content_value\n FROM " . table('lang') . " WHERE content_type= :content_type";
$result = or_query($query, $pars);
while ($line = pdo_fetch_assoc($result)) {
$cat[$line['content_name']] = stripslashes($line['content_value']);
}
$preloaded_lang_cats[$content_type][$language] = $cat;
return $cat;
}
}
示例10: expregister__get_participation_statuses
function expregister__get_participation_statuses()
{
global $participation_statuses, $lang;
if (!(is_array($participation_statuses) && count($participation_statuses) > 0)) {
$participation_statuses = array();
$query = "SELECT *\n \t\t\tFROM " . table('participation_statuses') . " \n \t\t\tORDER BY pstatus_id";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
$participation_statuses[$line['pstatus_id']] = $line;
}
$query = "SELECT *\n \t\t\tFROM " . table('lang') . "\n \t\t\tWHERE content_type='participation_status_internal_name' \n \t\t\tOR content_type='participation_status_display_name'\n \t\t\tORDER BY content_name";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
if ($line['content_type'] == 'participation_status_internal_name') {
$field = 'internal_name';
} else {
$field = 'display_name';
}
$participation_statuses[$line['content_name']][$field] = $line[lang('lang')];
}
}
return $participation_statuses;
}
示例11: admin__select_admin_type
function admin__select_admin_type($fieldname, $selected = "", $return_var = "type_name", $hide = array())
{
global $settings, $preloaded_admintypes;
$out = '';
if (!isset($preloaded_admintypes) || !is_array($preloaded_admintypes)) {
$preloaded_admintypes = array();
$query = "SELECT * from " . table('admin_types') . "\n\t\t\t\tORDER by type_name";
$result = or_query($query);
while ($line = pdo_fetch_assoc($result)) {
$preloaded_admintypes[$line['type_name']] = $line;
}
}
if (!isset($preloaded_admintypes[$selected])) {
$selected = $settings['default_admin_type'];
}
$out .= '<SELECT name="' . $fieldname . '">';
foreach ($preloaded_admintypes as $line) {
if (!in_array($line['type_id'], $hide)) {
$out .= '<OPTION value="' . $line[$return_var] . '"';
if ($line[$return_var] == $selected || $line['type_name'] == $selected) {
$out .= ' SELECTED';
}
$out .= '>' . $line['type_name'] . '</OPTION>';
}
}
$out .= '</SELECT>';
return $out;
}
示例12: calendar__get_user_for_ics_token
function calendar__get_user_for_ics_token($icstoken)
{
$pars = array(':icstoken' => $icstoken);
$query = "SELECT * FROM " . table('admin') . " WHERE MD5(concat(admin_id,'|-|',password_crypt))=:icstoken";
$result = or_query($query, $pars);
$admin = false;
while ($line = pdo_fetch_assoc($result)) {
$admin = $line;
}
return $admin;
}
示例13: pdfoutput__make_part_list
function pdfoutput__make_part_list($experiment_id, $session_id = "", $pstatus = "", $focus = "", $sort = "", $file = false, $tlang = "")
{
global $settings;
if ($tlang == "") {
global $lang;
} else {
$lang = load_language($tlang);
}
$experiment = orsee_db_load_array("experiments", $experiment_id, "experiment_id");
$pstatuses = expregister__get_participation_statuses();
if ($session_id) {
$clause = "session_id = '" . $session_id . "'";
$title = lang('registered_subjects');
} elseif (isset($pstatuses[$pstatus])) {
$clause = "pstatus_id = '" . $pstatus . "'";
if ($pstatus == 0) {
$clause .= " AND session_id != 0";
}
$title = lang('subjects_in_participation_status') . ' "' . $pstatuses[$pstatus]['internal_name'] . '"';
} elseif ($focus == 'enroled') {
$clause = "session_id != 0";
$title = lang('registered_subjects');
}
$cols = participant__get_result_table_columns('session_participants_list_pdf');
if ($session_id) {
unset($cols['session_id']);
}
// load sessions of this experiment
$pars = array(':experiment_id' => $experiment_id);
$query = "SELECT *\n\t\t\tFROM " . table('sessions') . "\n\t\t\tWHERE experiment_id= :experiment_id\n\t\t\tORDER BY session_start";
$result = or_query($query, $pars);
global $thislist_sessions;
$thislist_sessions = array();
while ($line = pdo_fetch_assoc($result)) {
$thislist_sessions[$line['session_id']] = $line;
}
// load participant data for this session/experiment
$pars = array(':experiment_id' => $experiment_id);
$select_query = "SELECT * FROM " . table('participate_at') . ", " . table('participants') . " \n\t\t\t\t\tWHERE " . table('participate_at') . ".experiment_id= :experiment_id\n\t\t\t\t\tAND " . table('participate_at') . ".participant_id=" . table('participants') . ".participant_id\n\t\t\t\t\tAND (" . $clause . ")";
$order = query__get_sort('session_participants_list_pdf', $sort);
if (!$order) {
$order = table('participants') . ".participant_id";
}
$select_query .= " ORDER BY " . $order;
// get result
$result = or_query($select_query, $pars);
$participants = array();
while ($line = pdo_fetch_assoc($result)) {
$participants[] = $line;
}
$result_count = count($participants);
// load sessions of this experiment
$pars = array(':texperiment_id' => $experiment_id);
$squery = "SELECT *\n FROM " . table('sessions') . "\n\t\t\tWHERE experiment_id= :texperiment_id \n ORDER BY session_start";
$result = or_query($squery, $pars);
$thislist_sessions = array();
while ($line = pdo_fetch_assoc($result)) {
$thislist_sessions[$line['session_id']] = $line;
}
// reorder by session date if ordered by session id
if ($sort == "session_id") {
$temp_participants = $participants;
$participants = array();
foreach ($thislist_sessions as $sid => $s) {
foreach ($temp_participants as $p) {
if ($p['session_id'] == $sid) {
$participants[] = $p;
}
}
}
}
unset($temp_participants);
// determine table title
$table_title = $experiment['experiment_public_name'];
if ($session_id) {
$table_title .= ', ' . lang('session') . ' ' . str_replace(" ", " ", session__build_name($thislist_sessions[$session_id]));
}
$table_title .= ' - ' . $title;
// determine table headings
$table_headings = participant__get_result_table_headcells_pdf($cols);
$table_data = array();
$pnr = 0;
foreach ($participants as $p) {
$pnr++;
$p['order_number'] = $pnr;
$row = participant__get_result_table_row_pdf($cols, $p);
$table_data[] = $row;
}
// prepare pdf
include_once '../tagsets/class.ezpdf.php';
$pdf = new Cezpdf('a4', 'landscape');
$pdf->selectFont('../tagsets/fonts/Times-Roman.afm');
$fontsize = $settings['participant_list_pdf_table_fontsize'] ? $settings['participant_list_pdf_table_fontsize'] : 10;
$titlefontsize = $settings['participant_list_pdf_title_fontsize'] ? $settings['participant_list_pdf_title_fontsize'] : 12;
$y = $pdf->ezTable($table_data, $table_headings, $table_title, array('gridlines' => 31, 'showHeadings' => 1, 'shaded' => 2, 'shadeCol' => array(1, 1, 1), 'shadeCol2' => array(0.9, 0.9, 0.9), 'fontSize' => $fontsize, 'titleFontSize' => $titlefontsize, 'rowGap' => 1, 'colGap' => 3, 'innerLineThickness' => 0.5, 'outerLineThickness' => 1, 'maxWidth' => 800, 'width' => 800, 'protectRows' => 2));
if ($file) {
$pdffilecode = $pdf->output();
return $pdffilecode;
} else {
$pdf->ezStream(array('Content-Disposition' => 'participant_list.pdf', 'Accept-Ranges' => 0, 'compress' => 1));
//.........这里部分代码省略.........
示例14: downloads__list_experiments
function downloads__list_experiments($showsize = false, $showtype = false, $showdate = false)
{
global $lang, $color, $expadmindata;
$out = '';
$continue = true;
if (check_allow('file_view_experiment_all')) {
$experimenter_clause = '';
$pars = array();
} elseif (check_allow('file_view_experiment_my')) {
$experimenter_clause = " AND " . table('experiments') . ".experimenter LIKE :experimenter ";
$pars = array(':experimenter' => '%|' . $expadmindata['admin_id'] . '|%');
} else {
$continue = false;
}
if ($continue) {
$query = "SELECT " . table('experiments') . ".*,\n (SELECT min(session_start) from or_sessions as s1 WHERE s1.experiment_id=" . table('experiments') . ".experiment_id) as first_session_date,\n (SELECT max(session_start) from or_sessions as s2 WHERE s2.experiment_id=" . table('experiments') . ".experiment_id) as last_session_date\n FROM " . table('experiments') . "\n WHERE " . table('experiments') . ".experiment_id IN\n (SELECT DISTINCT experiment_id FROM " . table('uploads') . ")\n " . $experimenter_clause . "\n ORDER BY last_session_date DESC";
$result = or_query($query, $pars);
$experiments = array();
while ($line = pdo_fetch_assoc($result)) {
$experiments[] = $line;
}
if (count($experiments) > 0) {
$out .= '<TABLE width=100% border=0>';
$shade = true;
foreach ($experiments as $exp) {
if ($shade) {
$bgcolor = ' bgcolor="' . $color['list_shade1'] . '"';
$shade = false;
} else {
$bgcolor = ' bgcolor="' . $color['list_shade2'] . '"';
$shade = true;
}
$out .= '<TR' . $bgcolor . '><TD>';
$out .= $exp['experiment_name'] . '</TD><TD>(';
$out .= lang('from') . ' ';
if ($exp['first_session_date'] == 0) {
$out .= '???';
} else {
$out .= ortime__format(ortime__sesstime_to_unixtime($exp['first_session_date']), 'hide_time:true');
}
$out .= ' ' . lang('to') . ' ';
if ($exp['last_session_date'] == 0) {
$out .= '???';
} else {
$out .= ortime__format(ortime__sesstime_to_unixtime($exp['last_session_date']), 'hide_time:true');
}
$out .= ')</TD><TD>';
$out .= experiment__list_experimenters($exp['experimenter'], true, true);
$out .= '</TD><TD><A HREF="download_main.php?experiment_id=' . $exp['experiment_id'] . '">' . lang('show_files') . '</A>';
$out .= '</TD></TR>';
}
$out .= '</TABLE>';
}
}
return $out;
}
示例15: experimentmail__send_participant_statistics
function experimentmail__send_participant_statistics()
{
global $lang, $settings;
$now = time();
$from = $settings['support_mail'];
$headers = "From: " . $from . "\r\n";
// remember the current language for later reset
$old_lang = lang('lang');
// preload details with current language
$maillang = $old_lang;
$statistics = stats__get_textstats_for_email();
$subject = load_language_symbol('subject_pool_statistics', $maillang) . ' ' . ortime__format($now, 'hide_time:true');
// get experimenters who want to receive the statistics
$query = "SELECT *\n FROM " . table('admin') . "\n WHERE get_statistics_mail='y'\n AND disabled='n'\n ORDER BY language";
$result = or_query($query);
$i = 0;
$rec_count = pdo_num_rows($result);
while ($admin = pdo_fetch_assoc($result)) {
if ($admin['language'] != $maillang) {
$maillang = $admin['language'];
$lang = load_language($maillang);
$statistics = stats__get_textstats_for_email();
$subject = load_language_symbol('subject_pool_statistics', $maillang) . ' ' . ortime__format($now, 'hide_time:true', $maillang);
}
$mailtext = load_mail("admin_participant_statistics_mailtext", $maillang) . "\n\n" . $statistics . "\n" . experimentmail__get_admin_footer($maillang, $admin) . "\n";
$message = process_mail_template($mailtext, $admin);
$done = experimentmail__mail($admin['email'], $subject, $message, $headers);
if ($done) {
$i++;
}
}
// reset language
if ($maillang != $old_lang) {
$lang = load_language($old_lang);
}
return "statistics sent to " . $i . " out of " . $rec_count . " administrators\n";
}