IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

PHP & Base de données Discussion :

syntaxe dans requete php/mysql (bis)


Sujet :

PHP & Base de données

  1. #1
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Novembre 2011
    Messages
    37
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2011
    Messages : 37
    Points : 27
    Points
    27
    Par défaut syntaxe dans requete php/mysql (bis)
    Bonjour,

    Je realise actuellement une application php/mysql devant permettre la gestion de notre teleprospection telephonique :
    Apres authentification on peut accerder a la page contenant le listing des clients et si on clique sur un icone sur la ligne d'un client on peut modifier la fiche de celui-ci.

    Or quand je clique sur le bouton de la page de modification j'obitiens une page d'erreur. Je n'arrive pas a trouver où cela bug je me tourne vers vous afin d'obtenir un regard "neuf" sur mon probleme voir peut etre une solution.

    Voici le descriptif de ma base sql

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
     
    -- phpMyAdmin SQL Dump
    -- version 4.0.4
    -- http://www.phpmyadmin.net
    --
    -- Client: localhost
    -- Généré le: Sam 26 Novembre 2016 à 16:35
    -- Version du serveur: 5.6.12-log
    -- Version de PHP: 5.4.12
     
    SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
    SET time_zone = "+00:00";
     
     
    /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
    /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
    /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
    /*!40101 SET NAMES utf8 */;
     
    --
    -- Base de données: `oni_test_2`
    --
    CREATE DATABASE IF NOT EXISTS `oni_test_2` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
    USE `oni_test_2`;
     
    -- --------------------------------------------------------
     
    --
    -- Structure de la table `admin`
    --
     
    CREATE TABLE IF NOT EXISTS `admin` (
      `adminid` tinyint(3) unsigned NOT NULL AUTO_INCREMENT,
      `adminusername` varchar(15) COLLATE latin1_general_ci NOT NULL,
      `adminpassword` varchar(15) COLLATE latin1_general_ci NOT NULL,
      PRIMARY KEY (`adminid`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=3 ;
     
    --
    -- Contenu de la table `admin`
    --
     
    INSERT INTO `admin` (`adminid`, `adminusername`, `adminpassword`) VALUES
    (1, 'admin', 'admin'),
    (2, 'william', 'fourche');
     
    -- --------------------------------------------------------
     
    --
    -- Structure de la table `appel`
    --
     
    CREATE TABLE IF NOT EXISTS `appel` (
      `id_appel` tinyint(8) unsigned NOT NULL AUTO_INCREMENT,
      `id_pers_appel` int(9) DEFAULT NULL,
      `num_oni_appel` int(11) DEFAULT NULL,
      `date_appel` date DEFAULT NULL,
      `comp_appel` text COLLATE utf8_unicode_ci,
      `rappeler_appel` tinyint(1) DEFAULT '0',
      `date_rappeler_appel` date DEFAULT NULL,
      `rappel_fait_appel` tinyint(1) DEFAULT '0',
      `doc_appel` tinyint(1) DEFAULT '0',
      `date_doc_appel` date DEFAULT NULL,
      `doc_fait_appel` tinyint(1) DEFAULT '0',
      `date_bis_appel` date DEFAULT NULL,
      `comp_bis_appel` text COLLATE utf8_unicode_ci,
      PRIMARY KEY (`id_appel`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=4 ;
     
    --
    -- Contenu de la table `appel`
    --
     
    INSERT INTO `appel` (`id_appel`, `id_pers_appel`, `num_oni_appel`, `date_appel`, `comp_appel`, `rappeler_appel`, `date_rappeler_appel`, `rappel_fait_appel`, `doc_appel`, `date_doc_appel`, `doc_fait_appel`, `date_bis_appel`, `comp_bis_appel`) VALUES
    (1, 4, 154, '2016-11-01', 'tout va bien', 0, '2016-11-02', 0, NULL, NULL, 0, NULL, NULL),
    (2, 4, 123, '2016-11-24', 'test raphael', 1, NULL, 0, 1, NULL, 0, NULL, NULL),
    (3, 4, 15696, '2016-11-01', 'wqq', 0, '2016-11-02', 0, 0, '2016-11-02', 0, '2016-11-22', NULL);
     
    -- --------------------------------------------------------
     
    --
    -- Structure de la table `personne`
    --
     
    CREATE TABLE IF NOT EXISTS `personne` (
      `id_pers` int(9) unsigned NOT NULL AUTO_INCREMENT,
      `num_oni_pers` int(9) DEFAULT NULL,
      `dep_pers` int(3) DEFAULT NULL,
      `nom_pers` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
      `prenom_pers` varchar(50) COLLATE utf8_unicode_ci NOT NULL,
      `ddn_pers` date DEFAULT NULL,
      `contacte` tinyint(1) DEFAULT '0',
      `num_appel_pers` int(12) DEFAULT NULL,
      `date_pers` date DEFAULT NULL,
      `comp_pers` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
      PRIMARY KEY (`id_pers`)
    ) ENGINE=InnoDB  DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci AUTO_INCREMENT=15 ;
     
    --
    -- Contenu de la table `personne`
    --
     
    INSERT INTO `personne` (`id_pers`, `num_oni_pers`, `dep_pers`, `nom_pers`, `prenom_pers`, `ddn_pers`, `contacte`, `num_appel_pers`, `date_pers`, `comp_pers`) VALUES
    (2, 123, 35, 'LAGARDE', 'RAPHAEL', '1974-05-26', 1, 11111, '1974-05-26', 'azertyuiop'),
    (4, 124, 53, 'FOURCHE', 'WILLIAM', NULL, 1, 0, NULL, NULL),
    (5, 125, 75, 'RODET', 'Denis', '1950-11-01', 0, 0, NULL, NULL),
    (7, 1234, 56, 'LEFEBVRE', 'JACQUELINE', '1943-06-08', 0, 0, '1943-06-08', NULL),
    (8, 789, 56, 'Star Nicolas', 'Kevin', '0000-00-00', 0, 68109, '2016-11-23', 'aqwxszedcvfr'),
    (9, 2589, 75, 'Amouroux', 'Thierry', '1969-05-27', 0, NULL, NULL, NULL),
    (10, 3698, 95, 'Huet', 'Bruno', '1970-05-28', 0, NULL, NULL, NULL),
    (11, 14785, 95, 'Henry', 'Pierre', '1974-05-24', 0, NULL, NULL, NULL),
    (12, 1234, 77, 'Veyer', 'Kine', '1955-11-28', 0, NULL, NULL, NULL),
    (13, 456987, 93, 'Test', 'Prenom', '1974-05-26', 0, NULL, NULL, NULL),
    (14, 45632589, 92, 'Petit', 'Carole', '1973-02-15', 0, NULL, NULL, NULL);
     
    /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
    /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
    /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
    Le code de ma page qui me pose probleme :
    Code :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
     
    <?php require_once('../Connections/ma_connexion.php'); ?>
    <?php require_once('security.php'); ?>
     
    <?php
    if (!function_exists("GetSQLValueString")) {
    function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
    {
      if (PHP_VERSION < 6) {
        $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
      }
     
      $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
     
      switch ($theType) {
        case "varchar":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "text":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;    
        case "long":
    		$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "int":
          $theValue = ($theValue != "") ? intval($theValue) : "NULL";
          break;
        case "double":
          $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
          break;
        case "date":
          $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
          break;
        case "defined":
          $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
          break;
      }
      return $theValue;
    }
    }
     
    mysql_select_db($database_ma_connexion, $ma_connexion);
    $query_RsListe = "SELECT * FROM appel";
    $RsListe = mysql_query($query_RsListe, $ma_connexion) or die(mysql_error());
    $row_RsListe = mysql_fetch_assoc($RsListe);
    $totalRows_RsListe = mysql_num_rows($RsListe);
     
    mysql_select_db($database_ma_connexion, $ma_connexion);
    $query_RsListe1 = "SELECT * FROM appel";
    $RsListe1 = mysql_query($query_RsListe1, $ma_connexion) or die(mysql_error());
    $row_RsListe1 = mysql_fetch_assoc($RsListe1);
    $totalRows_RsListe1 = mysql_num_rows($RsListe1);
    ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <title>Liste employés</title>
    <link href="../css/style.css" rel="stylesheet" type="text/css" />
    <link href="../css/cupertino/jquery-ui-1.8.23.custom.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../js/jquery-1.8.0.min.js"></script>
    <script type="text/javascript" src="../js/jquery.dataTables.js"></script>
    <script type="text/javascript" src="../js/jquery-ui-1.8.23.custom.min.js"></script>
     
    <script type="text/javascript" charset="utf-8">
    var oTable;
    $(document).ready(function() {
    	$Table = $('#menuTable').dataTable({
    		"bJQueryUI": true,
    		"sPaginationType": "full_numbers",
    		"oLanguage": { "sUrl": "../js/fr_FR.txt" },
    		"bAutoWidth": false,
    		"aoColumnDefs": [
          		{ "asSorting": [ "desc" ], "aTargets": [ 0 ] }
        	]
    		});
    });
    </script>
     
    </head>
     
    <body>
    <div id="wrapper">
    	<div id="header"><span>Test ONI - Listing appels</span></div>
    	<div id="navigation">
        <a href="liste_infirmiers.php">Liste des infirmiers</a>&nbsp;|&nbsp;<a href="ajout_appels.php">Ajouter un appel</a>&nbsp;|&nbsp;<a href="logout.php">D&eacute;connexion</a>
        </div>    
        <div id="container">
            <p id="ptitle">Liste des appels</p>
              <table width="100%" border="0" cellpadding="0" cellspacing="0" class="display" id="menuTable">
              <thead>
                <tr>
                  <th>id_appel</th>
                  <th>id_pers_appel</th>
                  <th>num_oni_appel</th>
                  <th>date_appel</th>
                  <th>comp_appel</th>
                  <th>rappeler_appel</th>
                  <th>date_rappel_appel</th>
                  <th>rappel_fait_appel</th>
                  <th>doc_appel</th>
                  <th>date_doc_appel</th>
                  <th>Actions</th>
                </tr>
              </thead>
              <tbody>
                  <?php do { ?>
                      <?php if ($totalRows_RsListe1 > 0) { // Show if recordset not empty ?>
      <tr>
        <td><?php echo $row_RsListe['id_appel']; ?></td>
        <td><?php echo $row_RsListe['id_pers_appel']; ?></td>
        <td><?php echo $row_RsListe['num_oni_appel']; ?></td>
        <td><?php echo $row_RsListe['date_appel']; ?></td>
        <td><?php echo $row_RsListe['comp_appel']; ?></td>
        <td><?php echo $row_RsListe['rappeler_appel']; ?></td>
        <td><?php echo $row_RsListe['date_rappel_appel']; ?></td>
        <td><?php echo $row_RsListe['rappel_fait_appel']; ?></td>
        <td><?php echo $row_RsListe['doc_appel']; ?></td>
        <td><?php echo $row_RsListe['date_doc_appel']; ?></td>
     
     
    <td align="center"><a href="modif_appels.php?id=<?php echo $row_RsListe['id_appel']; ?>"><img src="../images/edit.gif" width="16" height="16" alt="Edition" /></a>&nbsp;<a href="supp_appels.php?id=<?php echo $row_RsListe['id_appel']; ?>"><img src="../images/delete.gif" width="16" height="16" alt="Supprimer" /></a></td>
      </tr>
      <?php } // Show if recordset not empty ?>
    <?php } while ($row_RsListe = mysql_fetch_assoc($RsListe)); ?>
              </tbody>
              <tfoot>
                <tr><th colspan="6">&nbsp;</th></tr>
              </tfoot>
              </table>
        </div>
        <div id="footer">
          <p>Ticmed.fr</p>
        </div>
    </div>
    </body>
    </html>
    <?php
    mysql_free_result($RsListe);
     
    mysql_free_result($RsListe1);
    ?>
    voila la description de mon probleme :
    a) quand j'appelle par l'url : http://localhost/tuto_dream2/admin/m...miers.php?id=4
    la page apparait avec les informations uniquement dans les champs id_appel, date_appel, comp_appel et Actions. Pour les autres champs, j'ai des messages d'erreur du type " Notice: Undefined index: id_pers_appel in C:\wamp\www\tuto_dream2\admin\liste_appels.php on line 110"


    quelqu'un aurait il une idee, un conseil, une solution ?
    SVP merci

    Raphael

  2. #2
    Invité
    Invité(e)
    Par défaut
    Bonjour,
    Citation Envoyé par Raphaelphp Voir le message
    ...Je realise actuellement une application php/mysql...
    Je suis dubitatif...
    C'est un code récemment écrit, ou un (très) vieux code "remis à jour" ?

    Parce que là, presque tout est... obsolète !
    PHP, HTML, JS, SQL (mysql_)...

    Quant aux messages d'erreur, c'est normal puisque la requête est "SELECT * FROM appel", et les champs concernés ne sont pas dans cette table "appel".

  3. #3
    Nouveau membre du Club
    Profil pro
    Inscrit en
    Novembre 2011
    Messages
    37
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2011
    Messages : 37
    Points : 27
    Points
    27
    Par défaut
    Bonjour,

    ce code est un peu vieux mais il fonctionne sur un site et je tente de l'adapte sur la nouvelle table afin de ne pas devoir tout refaire (par manque de temps).

    Je ne comprend pas ce que tu dis " c'est normal puisque la requête est "SELECT * FROM appel", et les champs concernés ne sont pas dans cette table "appel". " or j'ai bien ces champs dans ma table (cf code mis a disposition).

    j'y comprend plus rien.

    Merci de ton aide

    Raphael

  4. #4
    Modératrice
    Avatar de Celira
    Femme Profil pro
    Développeuse PHP/Java
    Inscrit en
    Avril 2007
    Messages
    8 633
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Âge : 39
    Localisation : France

    Informations professionnelles :
    Activité : Développeuse PHP/Java
    Secteur : Industrie

    Informations forums :
    Inscription : Avril 2007
    Messages : 8 633
    Points : 16 372
    Points
    16 372
    Par défaut
    Essaye un var_dump($row_RsListe); juste après l'affectation pour voir ce qu'il y a réellement dans la variable.
    Modératrice PHP
    Aucun navigateur ne propose d'extension boule-de-cristal : postez votre code et vos messages d'erreurs. (Rappel : "ça ne marche pas" n'est pas un message d'erreur)
    Cherchez un peu avant poser votre question : Cours et Tutoriels PHP - FAQ PHP - PDO une soupe et au lit !.

    Affichez votre code en couleurs : [CODE=php][/CODE] (bouton # de l'éditeur) et [C=php][/C]

Discussions similaires

  1. [MySQL] Pb de syntax dans requete php/mysql
    Par Raphaelphp dans le forum PHP & Base de données
    Réponses: 2
    Dernier message: 21/11/2016, 14h50
  2. [debutant] Python, erreur syntaxe dans requete MYSQL !
    Par tutule dans le forum Général Python
    Réponses: 6
    Dernier message: 29/05/2010, 20h39
  3. requete php mysql
    Par calitom dans le forum Requêtes
    Réponses: 2
    Dernier message: 15/02/2006, 16h24
  4. syntaxe dans requete
    Par decour dans le forum Access
    Réponses: 2
    Dernier message: 30/09/2005, 16h55
  5. erreur syntaxe dans requete
    Par dom - ien moutiers dans le forum Requêtes
    Réponses: 5
    Dernier message: 19/04/2004, 11h54

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo