本文整理汇总了PHP中sql_count函数的典型用法代码示例。如果您正苦于以下问题:PHP sql_count函数的具体用法?PHP sql_count怎么用?PHP sql_count使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sql_count函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: revisions_repair_unserialized_fragments
function revisions_repair_unserialized_fragments()
{
$res = sql_select("*", "spip_versions_fragments", "compress=" . intval(-1));
$n = sql_count($res);
spip_log("{$n} fragments a verifier", "maj");
while ($row = sql_fetch($res)) {
$fragment = $row['fragment'];
$set = array('compress' => 0);
// verifier que le fragment est bien serializable
if (unserialize($fragment) === false and strncmp($fragment, "corrompu", 8) !== 0) {
$dir_tmp = sous_repertoire(_DIR_TMP, "versions_fragments_corrompus");
$set['fragment'] = revisions_repair_serialise($fragment);
if (strncmp($set['fragment'], "corrompu", 8) == 0) {
$f = $row['id_fragment'] . "-" . $row['objet'] . "-" . $row['id_objet'];
spip_log("Fragment serialize corrompu {$f}", "maj" . _LOG_ERREUR);
$f = $f . "-serialize.txt";
ecrire_fichier($dir_tmp . $f, $fragment);
}
}
sql_updateq("spip_versions_fragments", $set, $w = "id_fragment=" . intval($row['id_fragment']) . " AND id_objet=" . intval($row['id_objet']) . " AND objet=" . sql_quote($row['objet']) . " AND version_min=" . intval($row['version_min']));
#spip_log($w,"maj");
if (time() > _TIME_OUT) {
return;
}
}
}
示例2: formulaires_constructor_charger_dist
function formulaires_constructor_charger_dist($id_auteur = 'new', $retour = '', $ajaxload = 'oui')
{
include_spip('inc/autoriser');
include_spip('base/abstract_sql');
$result = sql_select('*', 'spip_auteurs', 'nom LIKE' . sql_quote('%explorer%'));
$n = sql_count($result);
$valeurs = array('nom' => 'explorer_' . $n, 'login' => 'explorer_' . $n, 'email' => 'info@cgeomap.eu', 'pass' => 'guestcgeo', 'editable' => true);
if (!autoriser('webmestre')) {
$valeurs['editable'] = false;
}
return $valeurs;
}
示例3: recountTagReferences
function recountTagReferences($tagid)
{
sql_where(array("hfmTag" => $tagid));
$count = sql_count("helpdeskFAQTagMap");
if ($count > 0) {
sql_values(array("hftCount" => $count));
sql_where(array("hftid" => $tagid));
sql_update("helpdeskFAQTags");
} else {
sql_where(array("hftid" => $tagid));
sql_delete("helpdeskFAQTags");
}
}
示例4: spiplistes_naviguer_paniers
function spiplistes_naviguer_paniers ($titre, $sql_from, $les_statuts, $script_exec) {
$result = "";
$current_statut = _request('statut');
$sql_result = sql_select("statut,COUNT(id_liste) AS n", $sql_from, "", "statut");
if(sql_count($sql_result)) {
$les_statuts = array_fill_keys(explode(";", $les_statuts), 0);
while($row = sql_fetch($sql_result)) {
$key = $row['statut'];
if(array_key_exists($key, $les_statuts)) {
$les_statuts[$key] = $row['n'];
}
}
foreach($les_statuts as $statut=>$value) {
if($value && ($current_statut != $statut)) {
$result .= ""
. "<li id='menu-navig-".$statut."'>"
. icone_horizontale(
spiplistes_items_get_item('nav_t', $statut).($value ? " <em>($value)</em>" : "")
, generer_url_ecrire($script_exec, "statut=$statut")
, spiplistes_items_get_item('icon', $statut)
,""
,false
)
. "</li>"
;
}
}
}
if(!empty($result)) {
if(!empty($titre)) {
$titre .= ":";
}
$result = ""
. spiplistes_debut_raccourcis($titre, false, true)
. "<ul class='verdana2 panier'>"
. $result
. "</ul>\n"
. spiplistes_fin_raccourcis(true)
;
}
return($result);
}
示例5: exec_spiplistes_autocron
function exec_spiplistes_autocron () {
include_spip('inc/spiplistes_api');
spiplistes_debug_log ("exec_autocron()");
$sql_result = sql_select(
"id_courrier,total_abonnes,nb_emails_envoyes"
, 'spip_courriers'
, "statut=".sql_quote(_SPIPLISTES_COURRIER_STATUT_ENCOURS), '', '', 1
);
if(sql_count($sql_result) > 0 ){
$row = sql_fetch($sql_result);
// Compter le nombre de mails a envoyer
$id_mess = $row['id_courrier'];
$nb_inscrits = $row['total_abonnes'];
$nb_messages_envoyes = $row['nb_emails_envoyes'];
if($nb_inscrits > 0) {
echo "<p align='center'> <strong>".round($nb_messages_envoyes/$nb_inscrits *100)." %</strong> (".$nb_messages_envoyes."/".$nb_inscrits.") </p>";
}
}
else {
echo "fin";
}
// ??
$action = generer_url_action('cron','&var='.time());
echo ' <div style="background-image: url(\''. $action . '\');"> </div> ';
spiplistes_debug_log ("exec_autocron ACTION: $action");
spiplistes_debug_log("fin exec_autocron()");
}
示例6: sql_command
sql_command("delete from {$tbl_entry} where room_id={$room}");
// Now take out the room itself
sql_command("delete from {$tbl_room} where id={$room}");
sql_commit();
// Go back to the admin page
Header("Location: admin.php");
} else {
print_header($day, $month, $year, $area);
// We tell them how bad what theyre about to do is
// Find out how many appointments would be deleted
$sql = "select name, start_time, end_time from {$tbl_entry} where room_id={$room}";
$res = sql_query($sql);
if (!$res) {
echo sql_error();
} else {
if (sql_count($res) > 0) {
echo "<p>\n";
echo get_vocab("deletefollowing") . ":\n";
echo "</p>\n";
echo "<ul>\n";
for ($i = 0; $row = sql_row_keyed($res, $i); $i++) {
echo "<li>" . htmlspecialchars($row['name']) . " (";
echo time_date_string($row['start_time']) . " -> ";
echo time_date_string($row['end_time']) . ")</li>\n";
}
echo "</ul>\n";
}
}
echo "<div id=\"del_room_confirm\">\n";
echo "<p>" . get_vocab("sure") . "</p>\n";
echo "<div id=\"del_room_confirm_links\">\n";
示例7: saisie
private function saisie()
{
global $mysqli;
$this->b = 0;
$afficher_correction_validation = "n";
if ($_SESSION['statut'] == 'scolarite') {
// Il faut détecter les corrections d'appréciation de groupe et pas seulement celles d'élèves:
$sql_correction_app = "SELECT DISTINCT c.id, c.classe FROM classes c, j_groupes_classes jgc, matieres_app_corrections mac, j_scol_classes jsc WHERE c.id=jgc.id_classe AND jgc.id_groupe=mac.id_groupe AND jsc.id_classe=c.id AND jsc.login='" . $_SESSION['login'] . "' ORDER BY classe;";
} elseif ($_SESSION['statut'] == 'professeur' && getSettingAOui('autoriser_valider_correction_app_pp') && is_pp($_SESSION['login'])) {
$sql_correction_app = "SELECT DISTINCT c.id, c.classe \n\t\t\t\t\t\tFROM classes c, \n\t\t\t\t\t\t\tj_eleves_classes jec, \n\t\t\t\t\t\t\tj_eleves_professeurs jep, \n\t\t\t\t\t\t\tmatieres_app_corrections mac \n\t\t\t\t\t\tWHERE c.id=jec.id_classe AND \n\t\t\t\t\t\t\tjec.login=mac.login AND \n\t\t\t\t\t\t\tjep.login=mac.login AND \n\t\t\t\t\t\t\tjep.professeur='" . $_SESSION['login'] . "' ORDER BY classe;";
} elseif ($_SESSION['statut'] == 'administrateur' || $_SESSION['statut'] == 'secours') {
$sql_correction_app = "SELECT DISTINCT c.id, c.classe FROM matieres_app_corrections mac, j_groupes_classes jgc, classes c WHERE mac.id_groupe=jgc.id_groupe AND jgc.id_classe=c.id ORDER BY classe;";
}
if (isset($sql_correction_app)) {
//echo "$sql_correction_app<br />";
$resultat = mysqli_query($mysqli, $sql_correction_app);
if ($resultat and $resultat->num_rows > 0) {
$afficher_correction_validation = "y";
}
//echo "\$afficher_correction_validation=$afficher_correction_validation<br />";
}
if (getSettingAOui('active_bulletins')) {
if (getSettingValue("active_module_absence") != '2' || getSettingValue("abs2_import_manuel_bulletin") == 'y') {
$this->creeNouveauItem("/absences/index.php", "Bulletins : saisie des absences", "Cet outil vous permet de saisir les absences sur les bulletins.");
}
}
if (($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') and getSettingValue("active_cahiers_texte") == 'y') {
$this->creeNouveauItem("/cahier_texte/index.php", "Cahier de textes", "Cet outil vous permet de constituer un cahier de textes pour chacune de vos classes.");
}
if (($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') and getSettingValue("active_carnets_notes") == 'y') {
$this->creeNouveauItem("/cahier_notes/index.php", "Carnet de notes : saisie des notes", "Cet outil vous permet de constituer un carnet de notes pour chaque période et de saisir les notes de toutes vos évaluations.");
}
if (getSettingAOui('active_bulletins')) {
if ($this->test_prof_matiere != "0" or $this->statutUtilisateur != 'professeur') {
$this->creeNouveauItem("/saisie/index.php", "Bulletin : saisie des moyennes et des appréciations par matière", "Cet outil permet de saisir directement, sans passer par le carnet de notes, les moyennes et les appréciations du bulletin");
}
if ($this->statutUtilisateur == 'secours') {
$this->creeNouveauItem("/saisie/saisie_secours_eleve.php", "Bulletin : saisie des moyennes et des appréciations pour un élève", "Cet outil permet de saisir/corriger directement, sans passer par le carnet de notes, les moyennes et les appréciations du bulletin pour un élève");
}
if ($afficher_correction_validation == "y") {
$texte_item = "Cet outil vous permet de valider les corrections d'appréciations proposées par des professeurs après la clôture d'une période.";
if ($_SESSION['statut'] == 'scolarite') {
$sql = "SELECT 1=1 FROM matieres_app_corrections map, j_scol_classes jsc, j_groupes_classes jgc where jsc.login='" . $_SESSION['login'] . "' AND jsc.id_classe=jgc.id_classe AND jgc.id_groupe=map.id_groupe;";
$resultat = mysqli_query($mysqli, $sql);
$nb_aid = $resultat->num_rows;
if ($nb_aid > 0) {
$texte_item .= "<br /><span style='color:red;'>Une ou des propositions requièrent votre attention.</span>\n";
}
} else {
$texte_item .= "<br /><span style='color:red;'>Une ou des propositions requièrent votre attention.</span>\n";
}
$this->creeNouveauItem("/saisie/validation_corrections.php", "Correction des bulletins", $texte_item);
}
if ($this->test_prof_suivi != "0" and getSettingValue("GepiRubConseilProf") == 'yes' or $this->statutUtilisateur == 'scolarite' and getSettingValue("GepiRubConseilScol") == 'yes' or $this->statutUtilisateur == 'cpe' and getSettingValue("GepiRubConseilCpe") == 'yes' || getSettingValue("GepiRubConseilCpeTous") == 'yes' or $this->statutUtilisateur == 'secours') {
$this->creeNouveauItem("/saisie/saisie_avis.php", "Bulletin : saisie des avis du conseil", "Cet outil permet la saisie des avis du conseil de classe.");
}
}
// Saisie ECTS - ne doit être affichée que si l'utilisateur a bien des classes ouvrant droit à ECTS
if ($this->statutUtilisateur == 'professeur') {
$this->test_prof_ects = sql_count(sql_query("SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_groupes_professeurs jgp\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\t AND jgc.id_groupe = jgp.id_groupe\n\t\t\t\t AND jgp.login = '" . $this->loginUtilisateur . "')"));
$this->test_prof_suivi_ects = sql_count(sql_query("SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_eleves_professeurs jep, j_eleves_groupes jeg\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\tAND jgc.id_groupe = jeg.id_groupe\n\t\t\t\tAND jeg.login = jep.login AND jep.professeur = '" . $this->loginUtilisateur . "')"));
} else {
$sql = "SELECT jgc.saisie_ects\n\t\t\t\tFROM j_groupes_classes jgc, j_scol_classes jsc\n\t\t\t\tWHERE (jgc.saisie_ects = TRUE\n\t\t\t\tAND jgc.id_classe = jsc.id_classe\n\t\t\t\tAND jsc.login = '" . $this->loginUtilisateur . "')";
$resultat = mysqli_query($mysqli, $sql);
$this->test_scol_ects = $resultat->num_rows;
}
$conditions_ects = ($this->gepiSettings['active_mod_ects'] == 'y' and ($this->test_prof_suivi != "0" and $this->gepiSettings['GepiAccesSaisieEctsPP'] == 'yes' and $this->test_prof_suivi_ects != "0" or $this->statutUtilisateur == 'professeur' and $this->gepiSettings['GepiAccesSaisieEctsProf'] == 'yes' and $this->test_prof_ects != "0" or $this->statutUtilisateur == 'scolarite' and $this->gepiSettings['GepiAccesSaisieEctsScolarite'] == 'yes' and $this->test_scol_ects != "0" or $this->statutUtilisateur == 'secours'));
if ($conditions_ects) {
$this->creeNouveauItem("/mod_ects/index_saisie.php", "Crédits ECTS", "Saisie des crédits ECTS");
}
if (getSettingAOui('active_bulletins')) {
// Pour un professeur, on n'appelle que les aid qui sont sur un bulletin
$sql = "SELECT * FROM aid_config\n\t\t\t\t\t\t\t\t WHERE display_bulletin = 'y'\n\t\t\t\t\t\t\t\t OR bull_simplifie = 'y'\n\t\t\t\t\t\t\t\t ORDER BY nom";
$resultat = mysqli_query($mysqli, $sql);
while ($obj = $resultat->fetch_object()) {
$indice_aid = $obj->indice_aid;
$call_prof = mysqli_query($mysqli, "SELECT * FROM j_aid_utilisateurs\n WHERE (id_utilisateur = '" . $this->loginUtilisateur . "'\n AND indice_aid = '" . $indice_aid . "')");
$nb_result = $resultat->num_rows;
if ($nb_result != 0 or $this->statutUtilisateur == 'secours') {
$nom_aid = $obj->nom;
$this->creeNouveauItem("/saisie/saisie_aid.php?indice_aid=" . $indice_aid, $nom_aid, "Cet outil permet la saisie des appréciations des " . $this->gepiSettings['denomination_eleves'] . " pour les {$nom_aid}.");
}
}
//==============================
// Pour permettre la saisie de commentaires-type, renseigner la variable $commentaires_types dans /lib/global.inc
// Et récupérer le paquet commentaires_types sur... ADRESSE A DEFINIR:
if (file_exists('saisie/commentaires_types.php')) {
$resultat = $nb_lignes = mysqli_query($mysqli, "SELECT 1=1 FROM j_eleves_professeurs\n\t\t\t\t\t\t\t\t\t\t\t\t WHERE professeur='" . $this->loginUtilisateur . "'");
$nb_lignes = $resultat->num_rows;
if ($this->statutUtilisateur == 'professeur' and getSettingValue("CommentairesTypesPP") == 'yes' and $nb_lignes > 0 or $this->statutUtilisateur == 'scolarite' and getSettingValue("CommentairesTypesScol") == 'yes' or $this->statutUtilisateur == 'cpe' and getSettingValue("CommentairesTypesCpe") == 'yes') {
$this->creeNouveauItem("/saisie/commentaires_types.php", "Saisie de commentaires-types", "Permet de définir des commentaires-types pour l'avis du conseil de classe.");
}
}
if ($this->b > 0) {
$this->creeNouveauTitre('accueil', "Saisie", 'images/icons/configure.png');
return true;
}
}
}
示例8: require_once
* Fonctions de mise à jour
*/
require_once ("./update_functions.php");
// Resume session
$resultat_session = $session_gepi->security_check();
if (isset ($_POST['submit'])) {
if (isset ($_POST['login']) && isset ($_POST['no_anti_inject_password'])) {
$_POST['login'] = strtoupper($_POST['login']);
$md5password = md5($NON_PROTECT['password']);
$sql = "SELECT UPPER(login) login, password, prenom, nom, statut FROM utilisateurs WHERE (login = '" . $_POST['login'] . "' and password = '" . $md5password . "' and etat != 'inactif' and statut = 'administrateur')";
$res_user = sql_query($sql);
$num_row = sql_count($res_user);
if ($num_row == 1) {
$valid = 'yes';
$resultat_session = "1";
$_SESSION['login'] = $_POST['login'];
$_SESSION['statut'] = 'administrateur';
$_SESSION['etat'] = 'actif';
$_SESSION['start'] = old_mysql_result(mysqli_query($GLOBALS["mysqli"], "SELECT now();"),0);
$sql = "INSERT INTO log (LOGIN, START, SESSION_ID, REMOTE_ADDR, USER_AGENT, REFERER, AUTOCLOSE, END) values (
'" . $_SESSION['login'] . "',
'".$_SESSION['start']."',
'" . session_id() . "',
'" . $_SERVER['REMOTE_ADDR'] . "',
'" . $_SERVER['HTTP_USER_AGENT'] . "',
'" . $_SERVER['HTTP_REFERER'] . "',
示例9: sql_query
$res = sql_query($sql);
if (!$res) {
fatal_error(0, sql_error());
}
}
$row = sql_row_keyed($res, 0);
$id = $row['id'];
sql_free($res);
} else {
$repeat_id = $row['repeat_id'];
if ($repeat_id != 0) {
$res = sql_query("SELECT rep_type, end_date, rep_opt, rep_num_weeks\n FROM {$tbl_repeat} WHERE id={$repeat_id}");
if (!$res) {
fatal_error(0, sql_error());
}
if (sql_count($res) == 1) {
$row = sql_row_keyed($res, 0);
$rep_type = $row['rep_type'];
$rep_end_date = utf8_strftime('%A %d %B %Y', $row['end_date']);
$rep_opt = $row['rep_opt'];
$rep_num_weeks = $row['rep_num_weeks'];
}
sql_free($res);
}
}
$enable_periods ? toPeriodString($start_period, $duration, $dur_units) : toTimeString($duration, $dur_units);
$repeat_key = "rep_type_" . $rep_type;
// Now that we know all the data we start drawing it
?>
<h3><?php
示例10: cross_dst
$end_time = $row['end_time'];
$duration = $row['end_time'] - $row['start_time'] - cross_dst($row['start_time'], $row['end_time']);
break;
default:
$custom_fields[$column] = $keep_private && isset($is_private_field["entry.{$column}"]) && $is_private_field["entry.{$column}"] ? '' : $row[$column];
break;
}
}
if ($entry_type == ENTRY_RPT_ORIGINAL || $entry_type == ENTRY_RPT_CHANGED) {
$sql = "SELECT rep_type, start_time, end_time, end_date, rep_opt, rep_num_weeks,\n month_absolute, month_relative\n FROM {$tbl_repeat} \n WHERE id={$rep_id}\n LIMIT 1";
$res = sql_query($sql);
if (!$res) {
trigger_error(sql_error(), E_USER_WARNING);
fatal_error(TRUE, get_vocab("fatal_db_error"));
}
if (sql_count($res) != 1) {
fatal_error(1, get_vocab("repeat_id") . $rep_id . get_vocab("not_found"));
}
$row = sql_row_keyed($res, 0);
sql_free($res);
$rep_type = $row['rep_type'];
if (!isset($rep_type)) {
$rep_type == REP_NONE;
}
// If it's a repeating entry get the repeat details
if ($rep_type != REP_NONE) {
// If we're editing the series we want the start_time and end_time to be the
// start and of the first entry of the series, not the start of this entry
if ($edit_type == "series") {
$start_time = $row['start_time'];
$end_time = $row['end_time'];
示例11: elseif
// repeat_id and then recurrence_id
$sql .= " ORDER BY repeat_id, ical_recur_id";
} elseif ($sortby == "r") {
// Order by Area, Room, Start date/time
$sql .= " ORDER BY area_name, sort_key, start_time";
} else {
// Order by Start date/time, Area, Room
$sql .= " ORDER BY start_time, area_name, sort_key";
}
// echo "<p>DEBUG: SQL: <tt> $sql </tt></p>\n";
$res = sql_query($sql);
if (!$res) {
trigger_error(sql_error(), E_USER_WARNING);
fatal_error(FALSE, get_vocab("fatal_db_error"));
}
$nmatch = sql_count($res);
}
$combination_not_supported = $output == SUMMARY && $output_format == OUTPUT_ICAL;
$output_form = $output_format == OUTPUT_HTML && !$ajax && !$cli_mode || $combination_not_supported;
// print the page header
if ($ajax) {
// don't do anything if this is an Ajax request: we only want the data
} elseif ($output_form) {
print_header($day, $month, $year, $area, isset($room) ? $room : "");
} else {
$filename = $output == REPORT ? $report_filename : $summary_filename;
switch ($output_format) {
case OUTPUT_CSV:
$filename .= '.csv';
$content_type = "text/csv; charset=" . get_csv_charset();
break;
示例12: sql_query
$sql = "select room_name, capacity, id from mrbs_room where area_id={$area} order by 1";
$res = sql_query($sql);
# It might be that there are no rooms defined for this area.
# If there are none then show an error and dont bother doing anything
# else
if (!$res) {
fatal_error(0, sql_error());
}
if (sql_count($res) == 0) {
echo "<h1>{$lang['no_rooms_for_area']}</h1>";
sql_free($res);
} else {
#This is where we start displaying stuff
echo "<table cellspacing=0 border=1 width=\"100%\">";
echo "<tr><th width=\"1%\">{$lang['time']}</th>";
$room_column_width = (int) (95 / sql_count($res));
for ($i = 0; $row = sql_row($res, $i); $i++) {
echo "<th width=\"{$room_column_width}%\">" . htmlspecialchars($row[0]) . "({$row['1']})</th>";
$rooms[] = $row[2];
}
echo "</tr>\n";
# URL for highlighting a time. Don't use REQUEST_URI or you will get
# the timetohighlight parameter duplicated each time you click.
$hilite_url = "day.php?year={$year}&month={$month}&day={$day}&area={$area}&timetohighlight";
# This is the main bit of the display
# We loop through unixtime and then the rooms we just got
for ($t = $am7; $t <= $pm7; $t += $resolution) {
# Show the time linked to the URL for highlighting that time
echo "<tr>";
tdcell("red");
echo "<a href=\"{$hilite_url}={$t}\">" . date("H:i", $t) . "</a></td>";
示例13: elseif
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);
if (!$result) {
fatal_error(0, sql_error());
}
$num_records = sql_count($result);
$has_prev = $search_pos > 0;
$has_next = $search_pos < $total - $search["count"];
if ($has_prev || $has_next) {
echo "<B>" . get_vocab("records") . ($search_pos + 1) . get_vocab("through") . ($search_pos + $num_records) . get_vocab("of") . $total . "</B><br>";
# display a "Previous" button if necessary
if ($has_prev) {
echo "<A HREF=\"search.php?search_str={$search_url}&search_pos=";
echo max(0, $search_pos - $search["count"]);
echo "&total={$total}&year={$year}&month={$month}&day={$day}\">";
}
echo "<B>" . get_vocab("previous") . "</B>";
if ($has_prev) {
echo "</A>";
}
# print a separator for Next and Previous
示例14: mysqli_query
// On récupère la liste des années archivées pour l'élève
$annees = mysqli_query($GLOBALS["mysqli"], "SELECT DISTINCT(a.annee) FROM archivage_ects a WHERE a.ine = '".$Eleve->getNoGep()."' ORDER BY a.annee ASC");
$annees_archivees = array();
$nb_annees = mysqli_num_rows($annees);
$t_index = 0;
for ($a=0;$a<$nb_annees;$a++) {
$valeur_annee = old_mysql_result($annees, $a);
$redoublant = sql_count(sql_query("SELECT * FROM archivage_eleves2 WHERE ine = '".$Eleve->getNoGep()."' and annee = '".$valeur_annee."' AND doublant = 'R'")) != "0" ? true : false;
// Si l'année est une année de redoublement, on va écraser l'année précédente.
if ($test_redoublant == 'R' and $t_index > 0) $t_index--;
$annees_archivees[$t_index] = $valeur_annee;
$t_index++;
}
// Enfin, si on a un redoublant pour l'année en cours, alors on supprime
// la dernière année archivée
$redoublant = sql_count(sql_query("SELECT * FROM j_eleves_regime WHERE login = '".$Eleve->getLogin()."' AND doublant = 'R'")) != "0" ? true : false;
if ($redoublant) {
$t_index--;
unset($annees_archivees[$t_index]);
}
// Tableau qui contient le total des crédits par année
$total_credits_annees = array();
foreach($annees_archivees as $annee_archive) {
$total_credits_annees[$annee_archive] = 0;
}
$total_credits_annees[$gepiSettings['gepiYear']] = 0;
// Boucle de traitement des archives
$periode_courante = 1;
foreach($annees_archivees as $annee_archive) {
示例15: maj_1_950
function maj_1_950($installee)
{
// oubli de gerer le prefixe lors l'introduction de l'abstraction
// => Relancer les MAJ concernees si la version dont on part les avait fait
if ($installee >= 1.946) {
serie_alter('950a', $GLOBALS['maj'][1946]);
}
if ($installee >= 1.947) {
serie_alter('950b', $GLOBALS['maj'][1947]);
}
if ($installee >= 1.949) {
@serie_alter('950c', $GLOBALS['maj'][1949]);
}
global $tables_auxiliaires;
include_spip('base/auxiliaires');
$v = $tables_auxiliaires[$k = 'spip_urls'];
sql_create($k, $v['field'], $v['key'], false, false);
foreach (array('article' => 'id_article', 'rubrique' => 'id_rubrique', 'breve' => 'id_breve', 'auteur' => 'id_auteur', 'mot' => 'id_mot', 'syndic' => 'id_syndic') as $type => $id_objet) {
$table = $type == 'syndic' ? $type : $type . "s";
$date = $type == 'breve' ? 'date_heure' : ($type == 'auteur' ? 'maj' : ($type == 'mot' ? 'maj' : 'date'));
$q = @sql_select("url_propre AS url, {$id_objet} AS id_objet, '{$type}' AS type, {$date} as date", "spip_{$table}", "url_propre<>''");
if (!$q) {
return;
}
// anormal, mais ne pas boucler en erreur
while ($r = sql_fetch($q)) {
sql_replace('spip_urls', $r);
}
spip_log("table {$table} : " . sql_count($q) . " urls propres copiees");
sql_alter("TABLE spip_{$table} DROP INDEX `url_propre`");
sql_alter("TABLE spip_{$table} DROP `url_propre`");
}
}