Salut a tous . Voila je vais ouvrir un site sur la guitare ,avec des videos .
Mais la j'ai un pb sur ma page d'administration .
Mais problème : quand je modifie ou ajoute une vidéo , rien n'est insrit dans la bdd . Je vous laisse voir par vous meme.
Le Liste_video.php
Code : PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>">
<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>" xml:lang="fr" >
<head>
<title>Liste des Vidéos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
h2, th, td
{
text-align:center;
color:#black;
font-family:Verdana, Arial, Helvetica, sans-serif
font-size:10px;
text-decoration:none;
font-family: Verdana, Arial, Helvetica, sans-serif}
}
table
{
border-collapse:collapse;
border:2px solid black;
margin:auto;
}
th, td
{
border:1px solid black;
}
body
{
margin: 0 auto;
padding: 0;
font: 76% Verdana,Tahoma,Arial,sans-serif;
background: url(images/marges/motif_bois.jpg);
text-align:center;
}
</style>
<style type="text/css">
</style>
</head>
<body>
<h2><a href="ajouter_video.php" ><u>Ajouter une vidéo</u></a></h2>
<?php
mysql_connect("localhost", "root", "") ;
mysql_select_db("vg");
//
if (isset($_POST['titre']) AND isset($_POST['lien']) AND isset($_POST['artiste']) AND isset($_POST['conseil']) AND isset($_POST['difficulte']))
{
$titre = addslashes($_POST['titre']);
$conseil = addslashes($_POST['conseil']);
$lien = addslashes($_POST['lien']);
$artiste = addslashes($_POST['artiste']);
$difficulte = addslashes($_POST['difficulte']);
if ($_POST['id_video'] == 0)
{
mysql_query("INSERT INTO videos(id_video, titre , conseil, difficulté, lien, artiste) VALUES(' ' , '$titre' , '$conseil ' , '$difficulté' , '$lien' , '$artiste')");
}
else
{
$_POST['id_video'] = addslashes($_POST['id_video']);
mysql_query("UPDATE videos SET titre='" . $titre . "', conseil='" . $conseil . "', lien='" . $lien . "', artiste='" . $artiste . "', difficulte='" . $difficulte . "' WHERE id_video='" . $_POST['id_video'] . "'");
}
}
if (isset($_GET['supprimer_video']))
{
$_GET['supprimer_video'] = addslashes($_GET['supprimer_video']);
mysql_query('DELETE FROM video WHERE id_video=\'' . $_GET['supprimer_video'] . '\'');
}
?>
<table><tr>
<th>Modifier</th>
<th>Supprimer</th>
<th>Titre</th>
<th>Artiste</th>
<th>Lien</th>
<th>Conseils</th>
<th>Difficulté</th>
</tr>
<?php
$retour = mysql_query('SELECT * FROM videos ORDER BY id_video DESC') or die(mysql_error());
while ($donnees = mysql_fetch_array($retour))
{
?>
<tr>
<td><?php echo '<a href="ajouter_video.php?modifier_video=' . $donnees['id_video'] . '">'; ?>Modifier</a></td>
<td><?php echo '<a href="liste_videos.php?supprimer_video=' . $donnees['id_video'] . '">'; ?>Supprimer</a></td>
<td><?php echo stripslashes($donnees['titre']); ?></td>
<td><?php echo stripslashes($donnees['artiste']); ?></td>
<td><?php echo stripslashes($donnees['lien']); ?></td>
<td><?php echo stripslashes($donnees['conseil']); ?></td>
<td><?php echo ($donnees['difficulte']); ?></td>
</tr>
<?php
}
mysql_close()
?>
</table>
</body>
</html>
Puis le ajouter_video.php
Code : PHP
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" target="_blank">http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd</a>">
<html xmlns="<a href="http://www.w3.org/1999/xhtml" target="_blank">http://www.w3.org/1999/xhtml</a>" xml:lang="fr" >
<head>
<title>Ajouter une vidéo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
h3, h2, th, td
{
text-align:center;
color:#black;
font-family:Verdana, Arial, Helvetica, sans-serif
font-size:10px;
text-decoration:none;
font-family: Verdana, Arial, Helvetica, sans-serif}
}
table
{
border-collapse:collapse;
border:2px solid black;
margin:auto;
}
th, td
{
border:1px solid black;
}
body
{
margin: 0 auto;
padding: 0;
font: 76% Verdana,Tahoma,Arial,sans-serif;
background: url(images/marges/motif_bois.jpg);
text-align:center;
}
</style>
</head>
<body>
<h3><a href="liste_videos.php">Retour à la liste des vidéos</a></h3>
<?php
mysql_connect("localhost", "root", "");
mysql_select_db("vg");
if (isset($_GET['modifier_video']))
{
$_GET['modifier_video'] = htmlentities($_GET['modifier_video'], ENT_QUOTES);
$retour = mysql_query('SELECT * FROM videos WHERE id_video=\'' . $_GET['modifier_video'] . '\'')or die(mysql_error());
$donnees = mysql_fetch_array($retour);
$titre = stripslashes($donnees['titre']);
$artiste = stripslashes($donnees['artiste']);
$conseil = stripslashes($donnees['conseil']);
$lien = stripslashes($donnees['lien']);
$difficulte = stripslashes($donnees['difficulte']);
$id_video = $donnees['id_video'];
}
else
{
$titre = '';
$conseil ='';
$lien = '';
$artiste = '';
$difficulte = '';
$id_video = 0;
}
?>
<form action="liste_videos.php" method="post">
<p>Titre : <input type="text" size="30" name="Titre" value="<?php echo $titre; ?>" /></p>
<p>Artiste : <input type="text" size="30" name="Artiste" value="<?php echo $artiste; ?>" /></p>
<p>Lien : <input type="text" size="30" name="Lien" value="<?php echo $lien; ?>" /></p>
<p>Difficulté : <input type="text" size="30" name="Difficulte" value="<?php echo $difficulte; ?>/10" /></p>
<p>
Conseils :<br />
<textarea name="conseils" cols="50" rows="10">
<?php echo $conseil; ?>
</textarea><br />
<input type="hidden" name="id_video" value="<?php echo $id_video; ?>" />
<input type="submit" value="Envoyer" />
</p>
</form>
</body>
</html>
Merci d'avance .