// mysql_func.php
/* Fonctions offrant une interface de base de données simple */
/* ---------------------------------------------------- */
function dicton($path){
mt_sRand(time());
$nombre=file($path);
$nombre=mt_rand( 1, sizeof($nombre));
if ($file = fopen($path, 'r')) {
for($index=0; $index < $nombre; $index++){
$chaine=fgets($file, 120);
}
if (fclose($file))
;
}
print ("\n");
}
function panel($result, $id, $depart, $fin){
//print "phase1 $depart $fin";
//$sql ="SELECT code_ag, text_ag, image_ag FROM art_group WHERE code_ag > '$depart' AND code_ag <'$fin'";
//print "
";
$qte=mysql_num_rows($result) ;
print ("
\n");
for ($i=0; $i<$qte; $i++){
$fichier = mysql_fetch_row($result, MYSQL_NUM);
//print"$fichier[1] | \n";
print ("![$fichier[1]]($Base_R/1computer/images/$fichier[2]) |
\n");
}
print ("
\n");
}
function afficheinfo($result){
$qte=mysql_num_rows($result);
$tabl=array (
"Lieu",
"Debut",
"Fin",
"Information",
"Level",
"Link",);
titre($tabl);
while ($row = mysql_fetch_row($result,MYSQL_NUM)) {
if($row[0] == ""){
print "$row[5] |
";//titre
}
else {
$RowColor = chgcolor();
//setlocal("LC_TIME","fr");
//$jour= date("d m Y",$row[0]);
print "";
print "$row[5] | \n";//lieu
print "$row[0] | \n";//debut
print "$row[1] | \n";//fin
//print "$row[2] | \n";//type
//print "$row[3] | \n";//groupe
print "$row[6] | \n";//libelle
print "$row[4] | \n";//level
print " | ";//lien
print "
";
print "";
}
}
print "";
}
function affichelink($result){
$qte=mysql_num_rows($result);
$tabl=array (
"Go To Link",
$qte ." Comment Informations Remarques",
"Level",);
titre($tabl);
while ($row = mysql_fetch_row($result,MYSQL_NUM)) {
if($row[3] == ""){
print "$row[0] |
";//titre
}
else {
$RowColor = chgcolor();
print "";
print " | ";//lien
print "$row[1] | \n";//libelle
for ($index=0; $index<$row[3]; $index++)
print " ";//score
print " |
";
print "";
}
}
print "";
}
function affiche($result, $depart, $arive){
$qte=mysql_num_rows($result) ;
$tabl=array (
"No",
$depart." sur ".$qte ." Articles (click pour Information)",
"Fr CH",
"Tax %",);
titre($tabl);
for($index=$depart; $index<$arive; $index++){
mysql_data_seek($result, $index);
$fichier = mysql_fetch_row($result,MYSQL_NUM);
$RowColor = chgcolor();
print "
";
print "$fichier[0] | \n";//article
print " | \n";//code
print "$fichier[2] | \n";//article
print "$fichier[3] | \n";//tax
//print "