Table inconnue 'type_matiere_premiere' dans where clause alors qu'elle existe
Ce script a pour utilité de me permettre de modifier des enregistrements via des requêtes update
le problème est que il y a un erreur qui survient Table inconnue 'type_matiere_premiere' dans where clause
pourtant la table type matière première existe.
Code:
1 2 3 4 5 6 7 8 9 10
|
CREATE TABLE type_matiere_premiere (
code_typ_mat_pre int(20) NOT NULL auto_increment,
code_four varchar(20) NOT NULL default '',
code_mat_pre varchar(20) NOT NULL default '',
couleur varchar(20) NOT NULL default '',
des_typ_mat_pre varchar(20) NOT NULL default '',
PRIMARY KEY (code_typ_mat_pre),
KEY code_four (code_four)
) TYPE=MyISAM; |
et voici le script le concernant!!
Code:
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
| <html>
<head><title>Modification matière première</title></head>
<body bgcolor="#00FFFF" text="#000000" vlink="#FF00FF" alink="#FFFFFF">
<table width="946" height="75" border="3" bordercolor="#FF0000">
<tr>
<td width="224"><? echo "bienvenu ".$_SESSION['login'];?></td><td width="702"><div align="right" class="Cellule_droite_bottom"><a href="logout.php" class="Style3">déconnexion</a></div></td>
</tr>
</table>
<?php
mysql_connect("localhost", "root", "") or die("La connexion au serveur a échoué");
mysql_select_db("art-mania") or die("La connexion à la base a échoué");
if (isset($_POST["btnmodif"]))
$d=$_POST["code_typ_mat_pre"];
else
$d=$_GET["id"];
$requete="select * from type_matiere_premiere,matiere_premiere,entree_stock where type_matiere_premiere.code_typ_mat_pre='$d' and matiere_premiere.code_mat_pre=type_matiere_premiere.code_mat_pre and entree_stock.code_typ_mat_pre=type_matiere_premiere.code_typ_mat_pre";
$result=mysql_query($requete);
$ligne=mysql_fetch_assoc($result);
echo '<form action=Modifier.php method=POST>';
echo '<table>';
echo '<tr><td>identifiant: </td><td><input type=text name=code_typ_mat_pre readonly=true value='.$d.'></td></tr>';
echo '<tr><td>matiere premiere : </td><td><input type=text name=des_mat_pre value='.$ligne["des_mat_pre"].'></td></tr>';
echo '<tr><td>type matière première : </td><td><input type=text name=des_typ_mat_pre value='.$ligne["des_typ_mat_pre"].'></td></tr>';
echo '<tr><td>Couleur : </td><td><input type=text name=couleur value='.$ligne["couleur"].'></td></tr>';
echo '<tr><td>quantité dans le stock:</td><td><input type=text name=entre_stock value='.$ligne["qte_stock"].'></td></tr>';
echo '<tr><td>prix:</td><td><input type=text name="pr_ttc" value='.$ligne["pr_ttc"].'></td></tr>';
echo '<tr><td></td><td><input type=submit value=Valider name=btnmodif></td></tr>';
echo '</table>';
echo '</form>';
if (isset($_POST["btnmodif"])){
$j=$_POST["entree_stock"];
$c=$_POST["pr_ttc"];
$n=$_POST["des_mat_pre"];
$p=$_POST["des_typ_mat_pre"];
$a=$_POST["couleur"];
$requete1="UPDATE entree_stock SET qte_stock='$j',pr_ttc='$c' WHERE entree_stock.code_typ_mat_pre='$d'";
echo "$requete1";
$result=mysql_query($requete1)OR die(mysql_error());
$requete2="UPDATE type_matiere_premiere SET des_typ_mat_pre='$p',couleur='$a' WHERE code_typ_mat_pre='$d'";
echo "$requete2";
$result=mysql_query($requete2)OR die(mysql_error());
$requete3="UPDATE matiere_premiere SET des_mat_pre='$n' where
matiere_premiere.code_mat_pre=type_matiere_premiere.code_mat_pre and type_matiere_premiere.code_typ_mat_pre='$d'";
echo "$requete3";
$result=mysql_query($requete3)OR die(mysql_error());
echo 'matière première modifiée';
}
mysql_close();
?>
<br><a href=liste_matiere_premiere.php >Liste des matière premières</a>
</body>
</html> |
et merci d'avance pour votre aide!