Identifient = identifient

Sinistrus Messages postés 1010 Date d'inscription   Statut Membre Dernière intervention   -  
nozino2000 Messages postés 55 Date d'inscription   Statut Membre Dernière intervention   -
Bonjour,

Depuis plus de 3 semaines j'essaie de concevoir un formulaire pour afficher les infos clients depuis une page php.
En fait, j'arrive à me connecter à la session, mais lorsque l'affichage se fait, il me donne le dernier enregistrement de la base de données.
J'ai compris le problème venait d'où :
$files = MySql::getConnection()->query("SELECT societe, date_jour, objet, debit, credit FROM comptes WHERE societe = '".intval($_SESSION['societe'])."' ORDER BY date_jour DESC")->fetch();


societe n'est pas égale à
$userinfo = MySql::getConnection()->query("SELECT id, username FROM utilisateurs WHERE id = '".intval($_SESSION['id'])."'")->fetch();


Donc il ne reconnait pas la société pour afficher les infos demandés.

Je vous demande de m'aider à lui dire que lorsque je suis connecté à un compte, qu'il me donne les infos concernant ce compte.

Prenons en compte que la table utilisateur à un identifiant unique qui est "societe"
et la table "comptes" doit récupérer tout les champs "societe" pour afficher.

Voici mon code :
<?php
include("bdd.php");
if (Auth::isClient() == false)
die("Vous devez être connecté.");
$files = MySql::getConnection()->query("SELECT id, date_jour, objet, debit, credit FROM comptes WHERE id = '".intval($_SESSION['id'])."' ORDER BY date_jour DESC")->fetch();
$userinfo = MySql::getConnection()->query("SELECT id, username FROM utilisateurs WHERE id = '".intval($_SESSION['id'])."'")->fetch();
$err = false;
$msg = "";
  
if (!empty($_GET['disco']) && $_GET['disco'] == '1') {
session_destroy(); 
header("Location: index.php");}
?>
<!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=utf-8" />
<title>Alifat Technologies - Comptes clients</title>
<style type="text/css">
@import url("../style.css");
#tableau 					{border-collapse: collapse; cursor:pointer;}
#tableau td 				{background: #FFFFFF;}
#tableau tbody tr:hover td 	{background: url(fond.png) no-repeat; color: #1576D7;}
#tableau a:hover 			{text-decoration:underline;}
</style>
</head>
<body>
<table width="980" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center"><img src="entete.png" width="940" height="125" /></td>
  </tr>
  <tr>
    <td align="center">&nbsp;</td>
  </tr>
  <tr>
    <td align="center"><img src="../images/Back_01.png" width="980" height="10" /></td>
  </tr>
  <tr>
    <td align="center" background="../images/Back_02.png"><table width="960" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td align="center">Vous êtes connecté en tant que :  <strong><?php echo htmlentities($userinfo[0]['username']); ?></strong><br />
          Votre solde est de : <strong>25.000.000</strong> F XOF<br /><br />
       <table width="820" border="0" cellspacing="0" cellpadding="0">
               <tr>
                <td width="10"><img src="../images/Cadre/01.png" width="10" height="10" /></td>
                <td width="800" background="../images/Cadre/02.png"><img src="../images/vide.png" width="1" height="10" /></td>
                <td width="10"><img src="../images/Cadre/03.png" width="10" height="10" /></td>
              </tr>
              <tr>
                <td background="../images/Cadre/04.png">&nbsp;</td>
                <td background="../images/Cadre/05.png">
                <table width="800" border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td width="100" height="21" align="center" bgcolor="#D2D2D2"><strong>Date</strong></td>
                    <td width="480" align="center" bgcolor="#D2D2D2"><strong>Objet</strong></td>
                    <td width="110" align="center" bgcolor="#D2D2D2"><strong>Débit</strong></td>
                    <td width="110" align="center" bgcolor="#D2D2D2"><strong>Crédit</strong></td>
                  </tr>
                </table>
                <table width="800" border="0" align="center" cellpadding="0" cellspacing="0" id="tableau">
                <?php
$i = 0;
  foreach ($files as $fichier)
		      {
$i++;
?>
                  <tr>
                    <td width="100" height="21" align="center"><?php echo htmlentities($fichier['date_jour']); ?></td>
                    <td width="480" align="left">&nbsp;<?php echo htmlentities($fichier['objet']); ?></td>
                    <td width="110" align="right"><?php echo htmlentities($fichier['debit']); ?>&nbsp;</td>
                    <td width="110" align="right"><?php echo htmlentities($fichier['credit']); ?>&nbsp;</td>
                  </tr>
                <?php } ?></table></td>
                <td background="../images/Cadre/06b.png">&nbsp;</td>
              </tr>
              <tr>
                <td><img src="../images/Cadre/07.png" width="10" height="10" /></td>
                <td background="../images/Cadre/08.png"><img src="../images/vide.png" width="1" height="10" /></td>
                <td><img src="../images/Cadre/09.png" width="10" height="10" /></td>
              </tr>
            </table><br />
<a href="javascript:window.print()" class="RolImpr"></a><br />
<br />
<a href="?disco=1">Se déconnecter</a>
            </td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td align="center"><img src="../images/Back_03.png" width="980" height="10" /></td>
  </tr>
</table>
</body>
</html>


1 réponse

Sinistrus Messages postés 1010 Date d'inscription   Statut Membre Dernière intervention   17
 
Ca ne m'aide pas beaucoup.
J'ai téléchargé winrar (bien que je ne vois pas le lien entre mon problème et la solution), et je ne vois pas de fichier s'appelant 676.

Voici mes deux tables:
CREATE TABLE IF NOT EXISTS 'comptes' (
  'id' int(11) NOT NULL auto_increment,
  'societe' varchar(50) NOT NULL,
  'date_jour' date NOT NULL,
  'objet' varchar(200) NOT NULL,
  'debit' double NOT NULL,
  'credit' double NOT NULL,
  PRIMARY KEY  ('id')
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;

CREATE TABLE IF NOT EXISTS 'utilisateurs' (
  'id' int(11) NOT NULL auto_increment,
  'societe' varchar(50) NOT NULL,
  'password' varchar(12) NOT NULL,
  'email' varchar(50) NOT NULL,
  'is_admin' tinyint(1) NOT NULL,
  PRIMARY KEY  ('id'),
  UNIQUE KEY 'societe' ('societe','email')
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;


J'ai appelé les deux champ pareillement "societe" pour faire "un" si ce doit être plus simplifié.
0
nozino2000 Messages postés 55 Date d'inscription   Statut Membre Dernière intervention   2
 
tu met dans un nouveau script,enregistrer format 695 dynamique et après tu trouve le fichier 676
0