Ce forum est maintenant fermé, seule cette archive statique reste consultable.
  FORUM Rue-Montgallet.com
  Programmation
  Php - Sql

  Probleme avec ajout de CD dans BDD !!

Bas de page
Auteur Sujet :

Probleme avec ajout de CD dans BDD !!

n°19279
ours70
Profil : Membre
Posté le 16-05-2008 à 19:57:34  
 

J'ai un probleme :  
 
J'aimerais ajouter des cd dans une BDD mais il me dit qu'il y a unez erreur , je ne la voit pas pouvez vous m'aider ??
 
Merci  
 
Voici le code !!
 
Page add_cd

Code :
  1. <?php
  2. require_once ("_protect.php" );
  3. if(isset($_SESSION['pseudo']) AND isset($_SESSION['motpass']))
  4. {
  5. ?>
  6. <form method="POST" action="confirm_cd.php">
  7. <?php
  8. include ("htpacces.php" );
  9. mysql_connect("$ftp", "$login", "$pass" );
  10. mysql_select_db("$bd" );
  11. if(isset($_GET['modif_cd']))
  12. {
  13.  $val=mysql_query('Select * From cd Where id_cd=\''.$_GET['modif_cd'].'\'');
  14. $val_rang=mysql_fetch_array($val);
  15. $id_cd=stripslashes($val_rang['id_cd']);
  16. $Nom_album=stripslashes($val_rang['Nom_album']);
  17. $Nom_artiste=stripslashes($val_rang['Nom_artiste']);
  18. $Date_Sortie=stripslashes($val_rang['Date_Sortie']);
  19. $Style_artiste=stripslashes($val_rang['Style_artiste']);
  20. $Synopsis_Artiste=stripslashes($val_rang['Synopsis_Artiste']);
  21. $Prix_Achat=stripslashes($val_rang['Prix_Achat']);
  22. $Marge=stripslashes($val_rang['Marge']);
  23. $Prix_Vente=stripslashes($val_rang['Prix_Vente']);
  24. $Stock=stripslashes($val_rang['Stock']);
  25. $Top_Ventes=stripslashes($val_rang['Top_Ventes']);
  26. $bouton="Modifier";
  27. echo '<title> Administration | Modifier un cd</title>';
  28. }
  29. else
  30. {
  31.  $id_cd='';
  32.  $Nom_album='';
  33.  $Nom_artiste='';
  34.  $Date_Sortie='';
  35.  $Style_artiste='';
  36.  $Synopsis_Artiste='';
  37.  $Prix_Achat='';
  38.  $Marge='';
  39.  $Prix_Vente='';
  40.  $Stock='';
  41.  $Top_Ventes='';
  42.    $bouton="Ajouter";
  43.  echo '<title>Administration | Ajouter un cd</title>';
  44. }
  45. ?>
  46. <CENTER><TABLE>
  47. <TR> AJOUT D'UN CD
  48. <TD>Nom du CD : <input type='text' size="50" maxlength="60" name="Nom_album" value='<?php echo $Nom_album; ?>'><BR><BR>
  49. </TD>
  50. </TR>
  51. <TR>
  52. <TD>Nom artiste: <input type="text" size="50" maxlength="60" name='Nom_artiste' value='<?php echo $Nom_artiste; ?>'><BR><BR>
  53. </TD>
  54. </TR>
  55. <TR>
  56. <TD>Date Sortie: <input type="text" size="50" maxlength="60" name='Date_Sortie' value='<?php echo $Date_Sortie; ?>'><BR><BR>
  57. </TD>
  58. </TR>
  59. <TR>
  60. <TR>
  61. <TD>Style artiste: <input type="text" size="50" maxlength="60" name='Style_artiste' value='<?php echo $Style_artiste; ?>'><BR><BR>
  62. </TD>
  63. </TR>
  64. <TR>
  65. <TD>Synopsis Artiste: <input type="text" size="50" maxlength="60" name='Synopsis_Artiste' value='<?php echo $Synopsis_Artiste; ?>'><BR><BR>
  66. </TD>
  67. </TR>
  68. <TR>
  69. <TD>Prix achat: <input type="text" size="50" maxlength="60" name='Prix_Achat' value='<?php echo $Prix_Achat; ?>'><BR><BR>
  70. </TD>
  71. </TR>
  72. <TR>
  73. <TD>Marge: <input type="text" size="50" maxlength="60" name='Marge' value='<?php echo $Marge; ?>'><BR><BR>
  74. </TD>
  75. </TR>
  76. <TR>
  77. <TD>Prix Vente: <input type="text" size="50" maxlength="60" name='Prix_Vente' value='<?php echo $Prix_Vente; ?>'><BR><BR>
  78. </TD>
  79. </TR>
  80. <TR>
  81. <TD>Stock: <input type="text" size="50" maxlength="60" name='Stock' value='<?php echo $Stock; ?>'><BR><BR>
  82. </TD>
  83. </TR>
  84. <TR>
  85. <TD>Top Vente: <input type="text" size="50" maxlength="60" name='Top_Ventes' value='<?php echo $Top_Ventes; ?>'><BR><BR>
  86. </TD>
  87. </TR>
  88. </TABLE><BR>
  89. <input type="submit" value="<?php echo $bouton; ?>">
  90. </CENTER></form>
  91. <?php
  92. }
  93. ?>


 
page :comfirm_cd

Code :
  1. <?php
  2. require_once ("_protect.php" );
  3. if(isset($_SESSION['pseudo']) AND isset($_SESSION['motpass']))
  4. {
  5. ?>
  6. <?php
  7. require_once ("htpacces.php" );
  8. mysql_connect($ftp, $login, $pass);
  9. mysql_select_db($bd);
  10. if(isset($_GET['delete_CD']))
  11. {
  12. echo '<title>Administration | Suppression d\'un CD</title>';
  13. echo '<META http-equiv="refresh" content="1; URL=admin.php">';
  14. $_GET['delete_CD']=addslashes($_GET['delete_CD']);
  15. mysql_query('DELETE FROM CD WHERE id_cd=\''.$_GET['delete_CD'].'\'');
  16. echo '<center> Le CD a été bien supprimé !! </center>';
  17. }
  18. else
  19. {
  20.  if(isset($val_rang['id_cd']) AND isset($val_rang['nom_album']) AND isset($val_rang['Nom_Artiste']) AND isset($val_rang['Date_Sortie']) AND isset($val_rang['Style_artiste']) AND isset($val_rang['Synopsis_Artiste']) AND isset($val_rang['Prix_Achat']) AND isset($val_rang['Marge']) AND isset($val_rang['Prix_Vente']) AND isset($val_rang['Stock']) AND isset($val_rang['Top_Ventes']))
  21.  {
  22. $id_cd=stripslashes($val_rang['id_cd']);
  23. $Nom_album=stripslashes($val_rang['Nom_album']);
  24. $Nom_artiste=stripslashes($val_rang['Nom_artiste']);
  25. $Date_Sortie=stripslashes($val_rang['Date_Sortie']);
  26. $Style_artiste=stripslashes($val_rang['Style_artiste']);
  27. $Synopsis_Artiste=stripslashes($val_rang['Synopsis_Artiste']);
  28. $Prix_Achat=stripslashes($val_rang['Prix_Achat']);
  29. $Marge=stripslashes($val_rang['Marge']);
  30. $Prix_Vente=stripslashes($val_rang['Prix_Vente']);
  31. $Stock=stripslashes($val_rang['Stock']);
  32. $Top_Ventes=stripslashes($val_rang['Top_Ventes']);
  33.   if($_POST['id_user']==1)
  34.    {
  35.     echo '<title>Administration | Confirmation d\'un ajout de CD</title>';
  36.     mysql_query("INSERT INTO CD VALUES('$id_cd', '$Nom_album', '$Nom_artiste', '$Date_Sortie', '$Style_artiste', '$Synopsis_Artiste', '$Prix_Achat', '$Marge', '$Prix_Vente', '$Stock', '$Top_Ventes')" ) OR die('Erreur SQL!<br>'.mysql_error());
  37.     echo '<center> Votre CD a été créé et enregistré !! </center>';
  38.     echo '<META http-equiv="refresh" content="1; URL=all_CD.php">';
  39.    }
  40.   else
  41.    {
  42.    echo '<title>Administration | Confirmation d\'une modification d\'un CD</title>';
  43.    $id_user=addslashes($_POST['id_user']);
  44.    mysql_query("UPDATE CD SET id_cd='id_cd', Nom_Album='$Nom_album', Nom_artiste='$Nom_artiste', Date_Sortie='$Date_Sortie', Style_artiste='$Style_artiste', Synopsis_Artiste='$Synopsis_Artiste', Prix_Achat='$Prix_Achat', Marge='$Marge', Prix_Vente='$Prix_Vente', Stock='$Stock', Top_Ventes='$Top_Ventes' WHERE Nom_album='$id_cd'" ) OR die('Erreur SQL!<br>'.mysql_error());
  45.    echo '<center> Votre CD a été modifié !! </center>';
  46.    echo '<META http-equiv="refresh" content="1; URL=all_CD.php">';
  47.    }
  48.  }
  49.  else
  50.  {
  51.   echo 'Vous n\'avez pas remplit tout les champs comportant <B>*</B>';
  52.   echo '<META http-equiv="refresh" content="1; URL=add_cd.php">';
  53.  }
  54. }
  55. ?>
  56. <?php
  57. }
  58. ?>


 


Message édité par ours70 le 16-05-2008 à 19:59:23
mood
Pub
Posté le 16-05-2008 à 19:57:34  
 

n°19308
ours70
Profil : Membre
Posté le 04-06-2008 à 09:32:52  
 

personne peut m'aider !!!

n°19309
kurt11
Profil : Habitué
Posté le 04-06-2008 à 12:24:42  
 

Ton erreur est à quelle ligne en gros ?


---------------
[:zzzinv] Membre de la team Mozilla Firefox et Opera
n°19314
ours70
Profil : Membre
Posté le 17-06-2008 à 18:15:24  
 

on me dit que l'erreur s'est que je n'ai pas rempli tout les champs or je les ai bine tous rempli mais rien ne va dans la base de donne !!

  FORUM Rue-Montgallet.com
  Programmation
  Php - Sql

  Probleme avec ajout de CD dans BDD !!

© 2000-2024 Forum.rue-montgallet.com - Tous droits réservés