negzt | bonjour a tous,
j'ai une erreur mais comme j suis pas trés bon en php je vous demande de l'aideeeee ...
mon erreur :
Fatal error: Call to undefined function: error_log() in /mnt/136/free.fr/c/2/****/***/config.php on line 16
voici mes page de code :
config.php
Code :
- <?php
- $host = '********';
- $login = '*****';
- $password = '****';
- $base = '*****';
- $repertoire_image = ******';
- class mysql {
- function exec_requete_app($requete, $nb_par_page) { // Execution de requete avec necessite d'affichage par page
- //Quand tu voudras utiliser une BDD décommente ces lignes
- // Utilisation avec MySQL
- global $nb_requete_total;
- //$nb_par_page = ( $modif_nb_page && isset($_GET['nb_pp']) ? ( $_GET['nb_pp']>0 ? $_GET['nb_pp'] : 5 ) : $nb_par_page=50 );
- $this -> res_requete_app = mysql_query($requete) OR DIE ($this->error_log($requete)); // Execution de la requete
- $nb_requete_total++;
- $this -> nb_requete_total = $nb_requete_total;
- $this -> nb_result = mysql_num_rows($this -> res_requete_app); // Compte le nombre de resultat trouver
- $this -> nb_page = ceil($this -> nb_result/$nb_par_page); // Nombre de page généré suite à la requete
- $this -> offset = isset($_GET['p']) ? $_GET['p'] : 1; // Numero de la page
- $this -> query = $requete.' LIMIT '.($this -> offset-1)*$nb_par_page.','.$nb_par_page;
- $this -> limite_nb_page = 9;
- }
- function url($k, $v) {
- $url = '';
- foreach($_GET as $key => $value) {
- if($k==$key) {
- if(strpos($url,'?')===false) {
- $url .= '?'.$key.'='.$v;
- } else {
- $url .= '&'.$key.'='.$v;
- }
- } else {
- if(strpos($url,'?')===false) {
- $url .= '?'.$key.'='.$value;
- } else {
- $url .= '&'.$key.'='.$value;
- }
- }
- }
- if(!array_key_exists('p',$_GET)) {
- if(strpos($url,'?')===false) {
- $url .= '?'.$k.'='.$v;
- } else {
- $url .= '&'.$k.'='.$v;
- }
- }
- return $url;
- }
- function affiche_navig() {
- if($this -> nb_page>1) {
- $navig = 'Page '.$this -> offset.'/'.$this -> nb_page;
- $navig .= " <select onChange=\"document.location.href='".$this -> url('p', '')."'+this.options[this.selectedIndex].value\">\n";
- for($i=1; $i<=$this -> nb_page; $i++) {
- $navig .= '<option value="'.$i.'"';
- if($this -> offset==$i) $navig .= 'selected';
- $navig .='>'.$i.'</option>';
- }
- $navig .= "</select><br />";
- if($this -> offset>1) {
- $navig .= '<a href="'.$this -> url('p', 1).'"><<< Première </a> ';
- $navig .= '<a href="'.$this -> url('p', ($this -> offset-1)).'"><< Précédente</a> ';
- }
- if($this -> offset==1 || $this -> offset<$this -> limite_nb_page) {
- $limite = $this -> limite_nb_page>$this -> nb_page ? $this -> nb_page : $this -> limite_nb_page;
- for($i=1;$i<=$limite;$i++) {
- if($this -> offset==$i) {
- $navig .= '<span>'.$i.'</span> ';
- } else {
- $navig .= '<a href="'.$this -> url('p', $i).'">'.$i.'</a> ';
- }
- }
- if($i<$this -> nb_page) $navig .= '...';
- } else {
- if($this -> offset==$this -> nb_page) {
- $navig .= '...';
- for($i=($this -> nb_page-9);$i<=$this -> nb_page;$i++) {
- if($this -> offset==$i) {
- $navig .= '<span>'.$i.'</span> ';
- } else {
- $navig .= '<a href="'.$this -> url('p', $i).'">'.$i.'</a> ';
- }
- }
- } else {
- if($this -> offset>=$this -> limite_nb_page) {
- $navig .= '...';
- if(($this -> offset+4>=$this -> nb_page-2)) {
- $limite = $this -> nb_page;
- } else {
- $limite = ($this -> offset+4)>$this -> nb_page ? $this -> nb_page : ($this -> offset+4);
- }
- for($i=($this -> offset-4);$i<=$limite;$i++) {
- if($this -> offset==$i) {
- $navig .= '<span>'.$i.'</span> ';
- } else {
- $navig .= '<a href="'.$this -> url('p', $i).'">'.$i.'</a> ';
- }
- }
- if($i<$this -> nb_page) $navig .= '...';
- }
- }
- }
- if($this -> offset<$this -> nb_page) {
- $navig .= '<a href="'.$this -> url('p', ($this -> offset+1)).'">Suivante >></a>';
- $navig .= '<a href="'.$this -> url('p', $this -> nb_page).'"> Dernière >>></a>';
- }
- $navig .= '';
- }
- return empty($navig) ? NULL : $navig;
- }
- }
- ?>
|
la page resultat.php
Code :
- <?php
- include 'config.php';
- mysql_connect($host,$login,$password) OR DIE (mysql_error());
- mysql_select_db($base) OR DIE (mysql_error());
- $bdd = new mysql;
- if(isset($_GET['tri']) AND !empty($_GET['tri'])) {
- $tri = $_GET['tri'];
- } else {
- $tri = 'date_match';
- }
- if(!isset($_GET['detail'])) {
- $bdd->exec_requete_app("SELECT id_match, team, pays, type, resultat FROM `membres` ORDER BY $tri DESC", 100);
- $req = mysql_query($bdd->query);
- echo '<table align="center" cellpadding="1" cellspacing="0" style="border: 1px solid #000000;"><tr><td width="90" style="border-bottom: 1px solid #000000;"><b>Nick</b></td><td width="30" style="border-bottom: 1px solid #000000;"><b><a href="?tri=pays">Pays</a></b></td><td width="50" style="border-bottom: 1px solid #000000;"><b><a href="?tri=type">Type</a></b></td></tr>';
- $i=0;
- while($aff = mysql_fetch_array($req)) {
- if($i%2 == 0) { $couleur = "#505066"; } else { $couleur = "#676770"; }
- echo '<tr bgcolor="'.$couleur.'"><td style="padding: 2px 0px 2px 0px;">'.$aff['team'].'</a></td><td><img src="'.$repertoire_image.'flags/'.$aff['pays'].'.gif"></td><td>'.$aff['type'].'</a></td></tr>';
- $i++ ;
- }
- echo '</table>';
- echo '<div align="center">'.$bdd->affiche_navig().'</div>';
- } else {
- $sql = ("SELECT id_match, team, pays, type, resultat FROM `membres` WHERE id_match='".$_GET['detail']."' LIMIT 1" );
- $req = mysql_query($sql);
- while($aff = mysql_fetch_array($req)) {
- echo '<table align="center" cellpadding="1" cellspacing="0" style="border: 1px solid #000000;">
- <tr>
- <td colspan="5" align="center" style="border-bottom: 1px solid #000000;"><b>Match Report</b></td>
- </tr>
- <tr>
- <td width="35"><b>Team</b></td>
- <td width="120"><a href="'.$aff['url_team'].'">'.$aff['team'].'</a> <img src="'.$repertoire_image.'flags/'.$aff['pays'].'.gif"></td>
- </tr>
- <tr>
- <td colspan="5">'.nl2br($aff['commentaire_report']).'</td>
- </tr>
- </table>
- ';
- }
- }
- ?>
|
la page admin/index.php
Code :
- <?php
- include '../config.php';
- mysql_connect($host,$login,$password) OR DIE (mysql_error());
- mysql_select_db($base) OR DIE (mysql_error());
- $bdd = new mysql;
- if(isset($_GET['tri']) AND !empty($_GET['tri'])) {
- $tri = $_GET['tri'];
- } else {
- }
- $bdd->exec_requete_app("SELECT * FROM `membres` ORDER BY $tri DESC", 50);
- $req = mysql_query($bdd->query);
- echo '<table align="center" cellpadding="1" cellspacing="0"><tr><td width="90"><b>Team</b></td><td width="30"><b><a href="?tri=pays">Pays</a></b></td><td width="50"><b><a href="?tri=type">Type</a></b></td><td width="50"><b>Modifier</b></td><td width="50"><b>Supprimer</b></td></tr>';
- $i=0;
- while($aff = mysql_fetch_array($req)) {
- if($i%2 == 0) { $couleur = "#E9E9E9"; } else { $couleur = "#FFFFFF"; }
- echo '<tr bgcolor="'.$couleur.'"><td style="padding: 2px 0px 2px 0px;">'.$aff['team'].'</a></td><td><img src="'.$repertoire_image.'flags/'.$aff['pays'].'.gif"></td><td>'.$aff['type'].'</td><td width="50"><a href="#" onClick="window.open(\'modif_match.php?id_match='.$aff['id_match'].'\',\'_blank\',\'toolbar=0, location=0, directories=0, status=0, scrollbars=0, resizable=0, copyhistory=0, menuBar=0, width=490, height=550\');return(false)">Modifier</a></td><td width="50"><a href="suppr_match.php?id_match='.$aff['id_match'].'">Supprimer</a></td></tr>';
- $i++ ;
- }
- echo '</table>';
- echo '<div align="center">'.$bdd->affiche_navig().'</div>';
- ?>
|
la page (pop up) admin/ajout.match.php
Code :
- <?php
- include '../config.php';
- mysql_connect($host,$login,$password) OR DIE (mysql_error());
- mysql_select_db($base) OR DIE (mysql_error());
- ?>
- <form action="../admin/ajout_match.php" method="POST">
- <br />
- Team <input type="text" name="team">
- <br />
- Pays <?php include 'liste_pays.php'; ?><br />
- Type <?php include 'liste_type.php'; ?><br />
- <br />
- <br />
- <br />
- <input type="submit" value="ajouter"> <input type="reset" value="recommencer">
- </form>
- <?php
- if(isset($_POST['team'])) {
- mysql_query("INSERT INTO `membres` VALUES ('', '".$_POST['team']."', '".$_POST['pays']."', '".$_POST['type']."')" );
- echo 'Match ajouté, tu peut fermer la fenetre';
- }
- ?>
|
j'ai crée ma table SQL
CREATE TABLE `membres` (
`id_match` int(11) NOT NULL auto_increment,
`team` tinytext collate latin1_general_ci NOT NULL,
`pays` tinytext collate latin1_general_ci NOT NULL,
`type` tinytext collate latin1_general_ci NOT NULL,
PRIMARY KEY (`id_match`)
)
------------------------- FIN ---------------------------
je pense vous avoir donné suffisament de donné,moi j suis perdu en plus d'etre novice en php.
merci d'avance Message édité par negzt le 30-01-2007 à 18:31:54
|