par
edison1986 » 28 avr. 2006, 09:47
ok desoler je ne voulai pas surcharger je vai t envoyer tout mon code donc
<?php
session_start();
include "Controle.php5";
$ctrl = new Controle();
<form method="POST" action="FicheSAV.php5" id="Materiel">
Type :
<select name="type" onchange="document.forms['Materiel'].submit();">
<?php
$ctrl->test();
echo("<option>------------------------------</option>");
$param[0] = 0;
echo("<option>on est apres les var</option>");
$ctrl->GererMateriel($paramazerthy);
echo("<option>on est apres GererMateriel et rep = $typeMat[0]</option>");
for($i = 1 ; $i <= $typeMat[0] ; $i++)
{
$matos = $typeMat[$i];
echo("<option>$matos[1]</option>");
}
echo("</select>");
if(isset($_POST['type']))
{
?>
Marque :
<select name="type2" onchange="document.forms['Materiel'].submit();">
<?php
echo("<option>-----------------------------------</option>");
$param[0] = 1; $param[1] = $_POST['type'];
$rep = $ctrl->GererMateriel($param);
for($i = 1 ; $i <= $rep[0] ; $i++)
{
$matos = $rep[$i];
echo("<option>$matos[2]</option>");
}
echo("</select>");
}
if(isset($_POST['type2']))
{
?>
Modele :
<select name="type3" onchange="document.forms['Materiel'].submit();">
<?php
echo("<option>----------------------------------</option>");
$param[0] = 2; $param[1] = $_POST['type']; $param[2] = $_POST['type2'];
$rep = $ctrl->GererMateriel($param);
for($i = 1 ; $i <= $rep[0] ; $i++)
{
$matos = $rep[$i];
echo("<option>$matos[3]</option>");
}
echo("</select>");
}
?>
</form>
la page controle.php5 :
<?php
include "BDD.php5";
include "SAV.php5";
class Controle
{
private $bdd;
private $identifiant;
private $sav;
private $id;
private $retour;
private $param;
function __construct()
{
$this->bdd = new BDD();
$this->identifiant = new Identification($this->bdd);
$this->sav = new SAV($this->bdd);
}
function GererMateriel($option)
{
echo("<br/>on est ds gererMateriel avec : $option[0]<br/>");
$this->id = $option;
$this->id = $this->sav->GererMateriel($this->id);
return $this->id;
}
}
?>
la page sav.php5 :
<?php
include "Fiche.php5";
class SAV extends Fiche
{
private $bdd;
function _construct($bdd)
{
$this->bdd = $bdd;
}
function constructionFiche($infoFiche)
{
$fiche[0] = $infoFiche[0];//-------------------------->idFicheSAV
$fiche[1] = $infoFiche[1];//-------------------------->titreFiche
$fiche[2] = $infoFiche[2];//-------------------------->idMateriel
$fiche[3] = substr($infoFiche[3] , 0 , 4);//---------->anne fin
$fiche[4] = substr($infoFiche[3] , 5 , 2);//---------->mois fin
$fiche[5] = substr($infoFiche[3] , 8 , 2);//---------->jour fin
$fiche[6] = $infoFiche[4];//-------------------------->info du client
$fiche[7] = $infoFiche[5];//-------------------------->commentaire
$taille = strlen($infoFiche[6]);
$fiche[8] = substr($infoFiche[6] , 0 , $taille-2);//-->heur duré
$fiche[9] = substr($infoFiche[6] , $taille-2 , 2);//-->minutes duré
$fiche[10] = substr($infoFiche[7] , 0 , 4);//---------->anné fiche
$fiche[11] = substr($infoFiche[7] , 5 , 2);//--------->mois fiche
$fiche[12] = substr($infoFiche[7] , 8 , 2);//--------->jour fiche
$fiche[13] = $infoFiche[8];//------------------------->idClient
return $fiche;
}
}
?>
la page fiche.php5
<?php
class Fiche
{
private $bdd;
private $param1;
private $param2;
private $select;
function __construct($bdd)
{
$this->bdd = $bdd;
}
function GererMateriel($param)
{
$this->select = $param[0];
$this->param1 = $param[1];
$this->param2 = $param[2];
if($this->select == 0)
$trame = "SELECT * FROM materiel GROUP BY type";
if($this->select == 1)
$trame = "SELECT * FROM materiel WHERE type = '$this->param1' GROUP BY marque";
if($this->select == 2)
$trame = "SELECT * FROM materiel WHERE type = '$this->param1' AND marque = '$this->param2' GROUP BY modele";
if($this->select == 3)
$trame = "SELECT * FROM materiel WHERE idMateriel = '$this->param1'";
else
$trame = "SELECT * FROM materiel WHERE type = '$this->select' AND marque = '$this->param1' AND modele = '$this->param2'";
$rep = $this->bdd->Rechercher($trame);
return $rep;
}
}
?>
et enfin la page bdd.php5 :
<?php
class BDD
{
private $option;
private $test;
private $result;
private $select;
private $cte = 0;
//***********Constructeur***********//
function __construct()
{
mysql_connect("localhost","root","identifiant");
mysql_select_db("log");
}
//***********Envoi de n'importe quel requette a la base (SELECT, SHOW, DESCRIBE, ...)**********//
function Query($option)
{
$this->option = $option;
$this->test = mysql_query($this->option);
return $this->test;
}
//**********Recupere le nombre de ligne d'un jeu de résultat*********//
function NumRows($option)
{
$this->option = $option;
$this->test = mysql_num_rows($this->option);
return $this->test;
}
//**********Retourne les info d un champ*********//
function FetchRow($option)
{
$this->option = $option;
$this->test = mysql_fetch_row($this->option);
return $this->test;
}
//**********Recherche ds la bdd renvoi en $att[0] le nombre de rep et en $att[n] n != 0 toute les reponses**********//
function Rechercher($id)
{
$this->option = $id;
$retour = $this->Query($this->option);
if($retour == FALSE)
return FALSE;
else
{
$nb = $this->NumRows($retour);
if($nb == FALSE)
return FALSE;
else
{
$att[0] = $nb;
for($i = 1 ; $i <= $nb; $i++)
{
$att[$i] = $this->FetchRow($retour);
}
return $att;
}
}
}
}
?>
donc voila je pense que se coup si j est envoyer se qu il faut j espere que tu poura m aider merci d avance.
ok desoler je ne voulai pas surcharger je vai t envoyer tout mon code donc
[php]
<?php
session_start();
include "Controle.php5";
$ctrl = new Controle();
<form method="POST" action="FicheSAV.php5" id="Materiel">
Type :
<select name="type" onchange="document.forms['Materiel'].submit();">
<?php
$ctrl->test();
echo("<option>------------------------------</option>");
$param[0] = 0;
echo("<option>on est apres les var</option>");
$ctrl->GererMateriel($paramazerthy);
echo("<option>on est apres GererMateriel et rep = $typeMat[0]</option>");
for($i = 1 ; $i <= $typeMat[0] ; $i++)
{
$matos = $typeMat[$i];
echo("<option>$matos[1]</option>");
}
echo("</select>");
if(isset($_POST['type']))
{
?>
Marque :
<select name="type2" onchange="document.forms['Materiel'].submit();">
<?php
echo("<option>-----------------------------------</option>");
$param[0] = 1; $param[1] = $_POST['type'];
$rep = $ctrl->GererMateriel($param);
for($i = 1 ; $i <= $rep[0] ; $i++)
{
$matos = $rep[$i];
echo("<option>$matos[2]</option>");
}
echo("</select>");
}
if(isset($_POST['type2']))
{
?>
Modele :
<select name="type3" onchange="document.forms['Materiel'].submit();">
<?php
echo("<option>----------------------------------</option>");
$param[0] = 2; $param[1] = $_POST['type']; $param[2] = $_POST['type2'];
$rep = $ctrl->GererMateriel($param);
for($i = 1 ; $i <= $rep[0] ; $i++)
{
$matos = $rep[$i];
echo("<option>$matos[3]</option>");
}
echo("</select>");
}
?>
</form>
[/php]
la page controle.php5 :
[php]
<?php
include "BDD.php5";
include "SAV.php5";
class Controle
{
private $bdd;
private $identifiant;
private $sav;
private $id;
private $retour;
private $param;
function __construct()
{
$this->bdd = new BDD();
$this->identifiant = new Identification($this->bdd);
$this->sav = new SAV($this->bdd);
}
function GererMateriel($option)
{
echo("<br/>on est ds gererMateriel avec : $option[0]<br/>");
$this->id = $option;
$this->id = $this->sav->GererMateriel($this->id);
return $this->id;
}
}
?>[/php]
la page sav.php5 :
[php]
<?php
include "Fiche.php5";
class SAV extends Fiche
{
private $bdd;
function _construct($bdd)
{
$this->bdd = $bdd;
}
function constructionFiche($infoFiche)
{
$fiche[0] = $infoFiche[0];//-------------------------->idFicheSAV
$fiche[1] = $infoFiche[1];//-------------------------->titreFiche
$fiche[2] = $infoFiche[2];//-------------------------->idMateriel
$fiche[3] = substr($infoFiche[3] , 0 , 4);//---------->anne fin
$fiche[4] = substr($infoFiche[3] , 5 , 2);//---------->mois fin
$fiche[5] = substr($infoFiche[3] , 8 , 2);//---------->jour fin
$fiche[6] = $infoFiche[4];//-------------------------->info du client
$fiche[7] = $infoFiche[5];//-------------------------->commentaire
$taille = strlen($infoFiche[6]);
$fiche[8] = substr($infoFiche[6] , 0 , $taille-2);//-->heur duré
$fiche[9] = substr($infoFiche[6] , $taille-2 , 2);//-->minutes duré
$fiche[10] = substr($infoFiche[7] , 0 , 4);//---------->anné fiche
$fiche[11] = substr($infoFiche[7] , 5 , 2);//--------->mois fiche
$fiche[12] = substr($infoFiche[7] , 8 , 2);//--------->jour fiche
$fiche[13] = $infoFiche[8];//------------------------->idClient
return $fiche;
}
}
?>[/php]
la page fiche.php5
[php]
<?php
class Fiche
{
private $bdd;
private $param1;
private $param2;
private $select;
function __construct($bdd)
{
$this->bdd = $bdd;
}
function GererMateriel($param)
{
$this->select = $param[0];
$this->param1 = $param[1];
$this->param2 = $param[2];
if($this->select == 0)
$trame = "SELECT * FROM materiel GROUP BY type";
if($this->select == 1)
$trame = "SELECT * FROM materiel WHERE type = '$this->param1' GROUP BY marque";
if($this->select == 2)
$trame = "SELECT * FROM materiel WHERE type = '$this->param1' AND marque = '$this->param2' GROUP BY modele";
if($this->select == 3)
$trame = "SELECT * FROM materiel WHERE idMateriel = '$this->param1'";
else
$trame = "SELECT * FROM materiel WHERE type = '$this->select' AND marque = '$this->param1' AND modele = '$this->param2'";
$rep = $this->bdd->Rechercher($trame);
return $rep;
}
}
?>[/php]
et enfin la page bdd.php5 :
[php]
<?php
class BDD
{
private $option;
private $test;
private $result;
private $select;
private $cte = 0;
//***********Constructeur***********//
function __construct()
{
mysql_connect("localhost","root","identifiant");
mysql_select_db("log");
}
//***********Envoi de n'importe quel requette a la base (SELECT, SHOW, DESCRIBE, ...)**********//
function Query($option)
{
$this->option = $option;
$this->test = mysql_query($this->option);
return $this->test;
}
//**********Recupere le nombre de ligne d'un jeu de résultat*********//
function NumRows($option)
{
$this->option = $option;
$this->test = mysql_num_rows($this->option);
return $this->test;
}
//**********Retourne les info d un champ*********//
function FetchRow($option)
{
$this->option = $option;
$this->test = mysql_fetch_row($this->option);
return $this->test;
}
//**********Recherche ds la bdd renvoi en $att[0] le nombre de rep et en $att[n] n != 0 toute les reponses**********//
function Rechercher($id)
{
$this->option = $id;
$retour = $this->Query($this->option);
if($retour == FALSE)
return FALSE;
else
{
$nb = $this->NumRows($retour);
if($nb == FALSE)
return FALSE;
else
{
$att[0] = $nb;
for($i = 1 ; $i <= $nb; $i++)
{
$att[$i] = $this->FetchRow($retour);
}
return $att;
}
}
}
}
?>[/php]
donc voila je pense que se coup si j est envoyer se qu il faut j espere que tu poura m aider merci d avance.