本文整理汇总了PHP中sql_query1函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_query1函数的具体用法?PHP sql_query1怎么用?PHP sql_query1使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_query1函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_prof
function is_prof($login, $matiere)
{
$test = sql_query1("select count(id_professeur) from j_professeurs_matieres where id_professeur = '" . $login . "' and id_matiere = '" . $matiere . "'");
if ($test > 0) {
return true;
} else {
return false;
}
}
示例2: __construct
function __construct($screen_id)
{
if (!is_numeric($screen_id)) {
return false;
}
$sql = "SELECT COUNT(id) FROM screen WHERE id = {$screen_id};";
if (sql_query1($sql)) {
$this->screen_id = $screen_id;
}
}
示例3: indexAction
function indexAction()
{
//Find feeds with active, approved graphical content
$this->feeds = Feed::list_all_by_type('WHERE feed.type != 3 AND type.id = 3
AND feed_content.moderation_flag = 1
AND content.start_time <= NOW() AND content.end_time >= NOW() AND content.mime_type LIKE "%image%"');
$this->content_count = array();
foreach ($this->feeds as $id => $feed) {
$sql = "SELECT COUNT(content.id) FROM feed_content\n LEFT JOIN content ON feed_content.content_id = content.id\n WHERE feed_content.feed_id = {$id} AND feed_content.moderation_flag = 1\n AND content.start_time <= NOW() AND content.end_time >= NOW() AND content.mime_type LIKE '%image%'\n GROUP BY feed_content.feed_id";
$this->feeds[$id]['count'] = sql_query1($sql);
}
}
示例4: showAction
function showAction()
{
list($this->category) = sql_select('page_category', array('page_category.*', 'page.name as default_page_name'), null, 'LEFT JOIN page on page.id = default_page ' . 'WHERE page_category.id = ' . $this->args[1]);
$sql = 'SELECT COUNT(page.id) FROM page WHERE page_category_id=' . $this->category['id'];
$this->count = sql_query1($sql);
if ($this->count < 0) {
$this->count = 0;
}
if (!$this->category) {
$this->flash('Category not found', 'error');
redirect_to(ADMIN_URL . "/page_categories");
}
$this->setSubject($this->category['name']);
$this->setTitle($this->category['name']);
}
示例5: Header
function Header()
{
$bord = 0;
//Police DejaVu gras 15
//$this->Image("../images/logo.gif", 0, 0, 50, 50);
$nom = $_SESSION['prenom'] . " " . $_SESSION['nom'];
if ($_SESSION['statut'] != "professeur") {
$user_statut = $_SESSION['statut'];
} else {
$nom_complet_matiere = sql_query1("select nom_complet from matieres where matiere = '" . $_SESSION['matiere'] . "'");
if ($nom_complet_matiere != '-1') {
$user_statut = "professeur de " . $nom_complet_matiere;
} else {
$user_statut = "Invité";
}
}
$etab_text = getSettingValue("gepiSchoolName") . " - année scolaire " . getSettingValue("gepiYear");
$gepi_text = "GEPI - Solution libre de Gestion des élèves par Internet";
$this->SetFont('DejaVu', '', 8);
//Calcul de la largeur des cellules
$l = (LargeurPage - LeftMargin - LeftMargin) / 2;
// on sauvegarde la position courante
$x = $this->GetX();
$y = $this->GetY();
// on imprime du texte à gauche
//$this->MultiCell($l, 5, $gepi_text,$bord, "L",0);
$this->MultiCell($l, 5, $gepi_text, $bord, "L", 0);
// déplace le curseur
$this->SetXY($x + $l, $y);
// on imprime du texte à droite
//$this->MultiCell($l, 5, $etab_text,$bord, "R",0);
$this->MultiCell($l, 5, $etab_text, $bord, "R", 0);
$this->MultiCell($l, 5, $nom . " - " . $user_statut, $bord, "L", 0);
// on trace un trait horizontal
$this->cell(0, 2, "", "T", 0);
// Saut de ligne et retour à la marge
$this->ln();
//Saut de ligne
}
示例6: classes
echo " | <a href='param_bull.php'>Paramétrage des bulletins</a>";
}
if (acces("/bulletin/verif_bulletins.php", $_SESSION['statut'])) {
echo " | <a href='verif_bulletins.php' title=\"Vérifier le remplissage des bulletins.\">Vérification bulletins</a>";
}
if (acces("/classes/dates_classes.php", $_SESSION['statut'])) {
echo "| <a href='../classes/dates_classes.php' title=\"Définir des événements particuliers pour les classes (conseils de classe, arrêt des notes,...).\">Événements classe</a>";
}
echo "</p>\n";
$texte_deverrouiller = urlencode("Déverrouiller");
$texte_verrouiller_part = urlencode("Verrouiller part.");
$texte_verrouiller_tot = urlencode("Verrouiller tot.");
// si la classe et la période sont définies (on vient de verif_bulletiin.php)
if (!($classe != 0 and $periode != 0)) {
// On va chercher les classes déjà existantes, et on les affiche.
$max_per = sql_query1("SELECT num_periode FROM periodes ORDER BY num_periode DESC LIMIT 1");
//$calldata = sql_query("SELECT DISTINCT c.id, c.classe FROM classes c, periodes p WHERE p.id_classe = c.id ORDER BY classe");
$calldata = mysqli_query($GLOBALS["mysqli"], "SELECT DISTINCT c.id, c.classe FROM classes c, periodes p, j_scol_classes jsc WHERE p.id_classe = c.id AND jsc.id_classe=c.id AND jsc.login='" . $_SESSION['login'] . "' ORDER BY classe");
$nombreligne = sql_count($calldata);
echo "Total : {$nombreligne} classes\n";
}
echo "<ul>\n<li>Lorsqu'une période est <b>déverrouillée</b>, le remplissage de toutes les rubriques (notes, appréciations, avis) est autorisé, la visualisation des\nbulletins simples est autorisée mais la visualisation et l'impression des bulletins officiels sont impossibles.<br /><br /></li>\n<li>Lorsqu'une période est <b>verrouillée partiellement</b>, seuls le remplissage et/ou la modification\nde l'avis du conseil de classe";
if ($gepiSettings['active_mod_ects'] == 'y') {
echo " et des crédits ECTS ";
}
echo " sont possibles. La visualisation et l'impression des bulletins officiels sont autorisées.<br /><br /></li>\n<li>Lorsqu'une période est <b>verrouillée totalement</b>, le remplissage et la modification du bulletin pour la période concernée\nsont impossibles. la visualisation et l'impression sont autorisées.</li>\n";
echo "</ul>\n";
echo "<br /><br />\n";
// si la classe et la période sont définies (on vient de verif_bulletin.php)
if ($classe != 0 and $periode != 0) {
echo "<form action=\"verrouillage.php?classe={$classe}&periode={$periode}&action={$action_apres}\" name=\"formulaire\" method=\"post\">\n";
示例7: sql_mutex_unlock
function sql_mutex_unlock($name)
{
global $sql_mutex_unlock_name;
sql_query1("SELECT RELEASE_LOCK('{$name}')");
$sql_mutex_unlock_name = "";
}
示例8: date
# Default parameters:
if (empty($debug_flag)) {
$debug_flag = 0;
}
if (empty($month) || empty($year) || !checkdate($month, 1, $year)) {
$month = date("m");
$year = date("Y");
}
$day = 1;
# print the page header
print_header($day, $month, $year, $area);
if (empty($area)) {
$area = get_default_area();
}
if (empty($room)) {
$room = sql_query1("select min(id) from mrbs_room where area_id={$area}");
}
# Note $room will be -1 if there are no rooms; this is checked for below.
# Month view start time. This ignores morningstarts/eveningends because it
# doesn't make sense to not show all entries for the day, and it messes
# things up when entries cross midnight.
$month_start = mktime(0, 0, 0, $month, 1, $year);
# What column the month starts in: 0 means $weekstarts weekday.
$weekday_start = (date("w", $month_start) - $weekstarts + 7) % 7;
$days_in_month = date("t", $month_start);
$month_end = mktime(23, 59, 59, $month, $days_in_month, $year);
if ($pview != 1) {
# Table with areas, rooms, minicals.
echo "<table width=\"100%\"><tr>";
$this_area_name = "";
$this_room_name = "";
示例9: priv_test
function priv_test($obj, $feed_id){
if(!is_numeric($feed_id)){
return false;
}
$group_string = implode(',',$obj->groups);
$sql = "SELECT COUNT(id) FROM feed WHERE id = $feed_id AND (type = 0 OR type = 1 OR type = 2 OR type = 4 OR (type = 3 AND group_id IN ($group_string)))";
if($res = sql_query1($sql)){
return $res;
} else {
return false;
}
}
示例10: function_exists
// not the form and we want to go straight to Phase 2 (producing the report)
if ($cli_mode) {
$phase = 2;
}
// 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();
}
$private_somewhere = some_area('private_enabled') || some_area('private_mandatory');
$approval_somewhere = some_area('approval_enabled');
$confirmation_somewhere = some_area('confirmation_enabled');
$times_somewhere = sql_query1("SELECT COUNT(*) FROM {$tbl_area} WHERE enable_periods=0") > 0;
$periods_somewhere = sql_query1("SELECT COUNT(*) FROM {$tbl_area} WHERE enable_periods!=0") > 0;
// 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
示例11: getdate
if (day_past_midnight()) {
$end_last = (($eveningends * 60 + $eveningends_minutes) * 60 + $resolution) % SECONDS_PER_DAY;
if ($start_seconds < $end_last) {
$start_seconds += SECONDS_PER_DAY;
$day_before = getdate(mktime(0, 0, 0, $start_month, $start_day - 1, $start_year));
$start_day = $day_before['mday'];
$start_month = $day_before['mon'];
$start_year = $day_before['year'];
}
}
// Check that the user has permission to create/edit an entry for this room.
// Get the id of the room that we are creating/editing
if (isset($id)) {
// Editing an existing booking: get the room_id from the database (you can't
// get it from $rooms because they are the new rooms)
$target_room = sql_query1("SELECT room_id FROM {$tbl_entry} WHERE id={$id} LIMIT 1");
if ($target_room < 0) {
trigger_error(sql_error(), E_USER_WARNING);
fatal_error(FALSE, get_vocab("fatal_db_error"));
}
} else {
// New booking: get the room_id from the form
if (!isset($rooms[0])) {
// $rooms[0] should always be set, because you can only get here
// from edit_entry.php, where it will be set. If it's not set
// then something's gone wrong - probably somebody trying to call
// edit_entry_handler.php directly from the browser - so get out
// of here and go somewhere safe.
header("Location: index.php");
exit;
}
示例12: get_string
}
}
if ($pview != 1) {
# Table with areas, rooms, minicals.
echo "<table width=\"100%\"><tr>";
$this_area_name = "";
$this_room_name = "";
# Show all areas
echo "<td width=\"30%\"><u>" . get_string('areas', 'block_mrbs') . "</u><br>";
}
# show either a select box or the normal html list
if ($area_list_format == "select") {
echo make_area_select_html('month.php', $area, $year, $month, $day);
# from functions.php
$this_area_name = sql_query1("select area_name from {$tbl_area} where id={$area}");
$this_room_name = sql_query1("select room_name from {$tbl_room} where id={$room}");
} else {
$sql = "select id, area_name from {$tbl_area} order by area_name";
$res = sql_query($sql);
if ($res) {
for ($i = 0; $row = sql_row($res, $i); $i++) {
if ($pview != 1) {
echo "<a href=\"month.php?year={$year}&month={$month}&area={$row['0']}\">";
}
if ($row[0] == $area) {
$this_area_name = htmlspecialchars($row[1]);
if ($pview != 1) {
echo "<font color=\"red\">{$this_area_name}</font></a><br>\n";
}
} else {
if ($pview != 1) {
示例13: get_vocab
}
if (!$search_str) {
echo "<H3>" . get_vocab("invalid_search") . "</H3>";
include "trailer.inc";
exit;
}
# now is used so that we only display entries newer than the current time
echo "<H3>" . get_vocab("search_results") . ": \"<font color=\"blue\">{$search_str}</font>\"</H3>\n";
$now = mktime(0, 0, 0, $month, $day, $year);
# This is the main part of the query predicate, used in both queries:
$sql_pred = "( " . sql_syntax_caseless_contains("E.create_by", $search_text) . " OR " . sql_syntax_caseless_contains("E.name", $search_text) . " OR " . sql_syntax_caseless_contains("E.description", $search_text) . ") AND E.end_time > {$now}";
# The first time the search is called, we get the total
# number of matches. This is passed along to subsequent
# searches so that we don't have to run it for each page.
if (!isset($total)) {
$total = sql_query1("SELECT count(*) FROM {$tbl_entry} E WHERE {$sql_pred}");
}
if ($total <= 0) {
echo "<B>" . get_vocab("nothing_found") . "</B>\n";
include "trailer.inc";
exit;
}
if (!isset($search_pos) || $search_pos <= 0) {
$search_pos = 0;
} elseif ($search_pos >= $total) {
$search_pos = $total - $total % $search["count"];
}
# Now we set up the "real" query using LIMIT to just get the stuff we want.
$sql = "SELECT E.id, E.create_by, E.name, E.description, E.start_time, R.area_id\n FROM {$tbl_entry} E, {$tbl_room} R\n WHERE {$sql_pred}\n AND E.room_id = R.id\n ORDER BY E.start_time asc " . sql_syntax_limit($search["count"], $search_pos);
# this is a flag to tell us not to display a "Next" link
$result = sql_query($sql);
示例14: is_dst
// 0 => entering DST
// 1 => leaving DST
$dst_change[$j] = is_dst($month, $day_start_week + $j, $year);
$am7[$j] = mktime($morningstarts, $morningstarts_minutes, 0, $month, $day_start_week + $j, $year, is_dst($month, $day_start_week + $j, $year, $morningstarts));
$pm7[$j] = mktime($eveningends, $eveningends_minutes, 0, $month, $day_start_week + $j, $year, is_dst($month, $day_start_week + $j, $year, $eveningends));
}
// Section with areas, rooms, minicals.
?>
<div class="screenonly">
<div id="dwm_header">
<?php
// Get the area and room names (we will need them later for the heading)
$this_area_name = "";
$this_room_name = "";
$this_area_name = htmlspecialchars(sql_query1("SELECT area_name FROM {$tbl_area} WHERE id={$area} LIMIT 1"));
$this_room_name = htmlspecialchars(sql_query1("SELECT room_name FROM {$tbl_room} WHERE id={$room} LIMIT 1"));
$sql = "select id, area_name from {$tbl_area} order by area_name";
$res = sql_query($sql);
// Show all available areas
// but only if there's more than one of them, otherwise there's no point
if ($res && sql_count($res) > 1) {
echo "<div id=\"dwm_areas\"><h3>" . get_vocab("areas") . "</h3>";
// show either a select box or the normal html list
if ($area_list_format == "select") {
echo make_area_select_html('week.php', $area, $year, $month, $day);
} else {
echo "<ul>\n";
for ($i = 0; $row = sql_row_keyed($res, $i); $i++) {
echo "<li><a href=\"week.php?year={$year}&month={$month}&day={$day}&area={$row['id']}\">";
echo "<span" . ($row['id'] == $area ? ' class="current"' : '') . ">";
echo htmlspecialchars($row['area_name']) . "</span></a></li>\n";
示例15: Mail_RFC822
$valid_email = new Mail_RFC822();
foreach ($emails as $email) {
// if no email address is entered, this is OK, even if isValidInetAddress
// does not return TRUE
if (!$valid_email->isValidInetAddress($email, $strict = FALSE) && '' != $email_var) {
// Now display this form again with an error message
Header("Location: edit_users.php?Action=Edit&Id={$Id}&invalid_email=1");
exit;
}
}
//
if ($Id >= 0) {
$operation = "replace into {$tbl_users} values (";
} else {
$operation = "insert into {$tbl_users} values (";
$Id = sql_query1("select max(id) from {$tbl_users};") + 1;
/* Use the last index + 1 */
/* Note: If the table is empty, sql_query1 returns -1. So use index 0. */
}
$i = 0;
foreach ($fields as $fieldname) {
if ($fieldname == "id") {
$value = $Id;
} else {
if ($fieldname == "name") {
$value = strtolower(get_form_var('Field_name', 'string'));
} else {
if ($fieldname == "password" && $password0 != "") {
$value = md5($password0);
} else {
$value = get_form_var("Field_{$fieldname}", $field_props[$fieldname]['istext'] ? 'string' : 'int');