par
reverb » 20 sept. 2013, 15:24
Re,
Concernant ma bdd, j'ai corrigé 'image_oeuvre' en supprimant : tel que definit : defaut.jpg ^^'.
Voici ma premiere table
-- Structure de la table `oeuvre_artiste`
--
CREATE TABLE IF NOT EXISTS `oeuvre_artiste` (
`artiste_id` int(11) NOT NULL,
`titre_oeuvre` varchar(100) NOT NULL,
`description_oeuvre` text NOT NULL,
`image_oeuvre` varchar(100) NOT NULL,
`oeuvre_categorie` int(11) NOT NULL,
`oeuvre_style` int(11) NOT NULL,
`oeuvre_id` int(11) NOT NULL AUTO_INCREMENT,
`date_crea` date NOT NULL,
`date_edit` date NOT NULL,
PRIMARY KEY (`oeuvre_id`),
KEY `titre_oeuvre` (`titre_oeuvre`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Stockage oeuvre' AUTO_INCREMENT=1 ;
ma deuxième table :
-- Structure de la table `oeuvre_style`
--
CREATE TABLE IF NOT EXISTS `oeuvre_style` (
`styoe_id` int(11) NOT NULL,
`styoe_style` int(11) NOT NULL,
`styoe_nomstyle` varchar(50) NOT NULL,
`styoe_ordre` int(11) NOT NULL,
KEY `styoe_nomstyle` (`styoe_nomstyle`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Oeuvre style';
et ma troisième table :
-- Structure de la table `oeuvre_categorie`
--
CREATE TABLE IF NOT EXISTS `oeuvre_categorie` (
`catov_id` int(11) NOT NULL,
`catov_categorie` int(11) NOT NULL,
`catov_nomcat` varchar(50) NOT NULL,
`catov_ordre` int(11) NOT NULL,
PRIMARY KEY (`catov_id`),
KEY `catov_nomcat` (`catov_nomcat`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Categorie des oeuvres';
c'est trois table seront utilisé pour classer chaque image ajouté par tel membre etc...
La difficulté que j'ai est par rapport au code php :/ mettre en place toutes les liaisons etc :/
voici mon code php mis à jour :
<?php session_start(); ?>
<?php require_once("connexioninscription.inc.php"); ?>
<?php
$query=$bdd->prepare('SELECT artiste_id, titre_oeuvre, description_oeuvre, image_oeuvre, oeuvre_categorie, oeuvre_style, oeuvre_id, date_crea, date_edit FROM oeuvre_artiste');
if (empty($_SESSION['membre_id']))
{
echo '<p class="textewarning">'."vous devez vous connectez pour accéder à la publication oeuvre".'</p>';
}
else
{
echo '<form method="post" action="" enctype="multipart/form-data">
<legend><p class="textesimple"><b>Ajout d\'une oeuvre</b></p></legend>
<div id="encartpubldiv"><div id="encpubldiv"><label for="titre"><p class="textesimple">Titre : </label><input type="text" name="titre" id="oeuvretitre" placeholder="Choisissez un titre"/></p></div>
<legend><p class="textesimple"><b>Sélectionnez une oeuvre</b></p></legend>
<div id="encpubldiv"><label for="oeuvre"><p class="textesimple">Image : </label><input type="file" name="image_oeuvre"/></p></div>
<legend><p class="textesimple"><b>Décrivez votre oeuvre</b></p></legend>
<div id="encpubldiv"><label for="description"><p class="textesimple">Description : </label><textarea name="oeuvredescription" id="description" cols="40" rows="5" placeholder="Ecrivez une description de votre oeuvre ici !"></textarea></p></div>
<legend><p class="textesimple"><b>Classification</b></p></legend>
<div id="encpubldiv"><label for="categorie"><p class="textesimplesans">Catégorie : </label>
<select name="categorie" id="categorie">
<option value="peinture">Peinture</option>
<option value="croquis">Croquis</option>
<option value="dessin">Dessin</option>
<option value="graphe">Graphe</option>
<option value="autre">Autre...</option>
</select></p></div>
<div id="encpubldiv"><label for="style"><p class="textesimplesans">Style : </label>
<select name="style" id="style">
<option value="abstrait">Abstrait</option>
<option value="arturbain">Art urbain</option>
<option value="baroc">Baroc</option>
<option value="cubisme">Cubisme</option>
<option value="dadaisme">Dadaisme</option>
<option value="expressionnisme">Expressionnisme</option>
<option value="fauvisme">Fauvisme</option>
<option value="futurisme">Futurisme</option>
<option value="gothisme">Gothisme</option>
<option value="hyperrealisme">Hyperrealisme</option>
<option value="impressionnisme">Impressionnisme</option>
<option value="rococo">Rococo</option>
<option value="romantisme">Romantisme</option>
<option value="lettrisme">Lettrisme</option>
<option value="modernisme">Modernisme</option>
<option value="naturalisme">Naturalisme</option>
<option value="neoclassicisme">Néoclassicisme</option>
<option value="neogothique">Néogothique</option>
<option value="pointillisme">Pointillisme</option>
<option value="popart">Popart</option>
<option value="photorealisme">Photoréalisme</option>
<option value="postimpressionnisme">Postimpressionnisme</option>
<option value="surréalisme">Surréalisme</option>
<option value="symbolisme">Symbolisme</option>
<option value="autre">Autre...</option>
</select></p></div>
<legend><p class="textesimple"><b>Date de réalisation</b></p></legend>
<div id="encpubldiv"><label for="datecreaoeuvre"><p class="textesimple">Date de création : </label><input type="text" name="datecreaoeuvre" id="datecreaoeuvre" placeholder="AAAA-MM-JJ"/></p></div>
<input type="submit" name="envoyer" value="envoyer"/>
</div></form>';
if (isset($_POST['envoyer']))
{
if (!empty($_FILES))
{
$imgpublication=$_FILES['image_oeuvre'];
$ext = strtolower(pathinfo($imgpublication['image_oeuvre']['name'],PATHINFO_EXTENSION));
$allow_ext = array('jpg','png','gif','bmp','jpeg');
if (in_array($ext,$allow_ext))
{
move_uploaded_file($imgpublication['image_oeuvre']['tmp_name'],"images/oeuvres/".$imgpublication['image_oeuvre']['name']);
$id=($_SESSION['membre_id']);
$query1 = $bdd->prepare('UPDATE membres SET image_oeuvre=:oeuvre, oeuvre_id=:oid WHERE artiste_id=:id');
$query1->bindValue(':oeuvre',$imgpublication,PDO::PARAM_STR);
$query1->bindValue(':id',$id,PDO::PARAM_INT);
$query1->execute();
$query1->CloseCursor();
}
}
else
{
$erreurpublication = "Votre fichier contient une mauvaise extension, ou n'est pas une image.";
}
if (isset($erreurpublication))
{
echo $erreurpublication;
}
$titre = ($_POST['titre']);
$oeuvredescription = ($_POST['oeuvredescription']);
$style = ($_POST['style']);
$datecreaoeuvre = ($_POST['datecreaoeuvre']);
}
}
?>
Merci pour votre attention et votre aide ^^,
Sincèrement.
Re,
Concernant ma bdd, j'ai corrigé 'image_oeuvre' en supprimant : tel que definit : defaut.jpg ^^'.
Voici ma premiere table
[sql]-- Structure de la table `oeuvre_artiste`
--
CREATE TABLE IF NOT EXISTS `oeuvre_artiste` (
`artiste_id` int(11) NOT NULL,
`titre_oeuvre` varchar(100) NOT NULL,
`description_oeuvre` text NOT NULL,
`image_oeuvre` varchar(100) NOT NULL,
`oeuvre_categorie` int(11) NOT NULL,
`oeuvre_style` int(11) NOT NULL,
`oeuvre_id` int(11) NOT NULL AUTO_INCREMENT,
`date_crea` date NOT NULL,
`date_edit` date NOT NULL,
PRIMARY KEY (`oeuvre_id`),
KEY `titre_oeuvre` (`titre_oeuvre`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Stockage oeuvre' AUTO_INCREMENT=1 ;[/sql]
ma deuxième table :
[sql]-- Structure de la table `oeuvre_style`
--
CREATE TABLE IF NOT EXISTS `oeuvre_style` (
`styoe_id` int(11) NOT NULL,
`styoe_style` int(11) NOT NULL,
`styoe_nomstyle` varchar(50) NOT NULL,
`styoe_ordre` int(11) NOT NULL,
KEY `styoe_nomstyle` (`styoe_nomstyle`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Oeuvre style';[/sql]
et ma troisième table :
[sql]-- Structure de la table `oeuvre_categorie`
--
CREATE TABLE IF NOT EXISTS `oeuvre_categorie` (
`catov_id` int(11) NOT NULL,
`catov_categorie` int(11) NOT NULL,
`catov_nomcat` varchar(50) NOT NULL,
`catov_ordre` int(11) NOT NULL,
PRIMARY KEY (`catov_id`),
KEY `catov_nomcat` (`catov_nomcat`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Categorie des oeuvres';[/sql]
c'est trois table seront utilisé pour classer chaque image ajouté par tel membre etc...
La difficulté que j'ai est par rapport au code php :/ mettre en place toutes les liaisons etc :/
voici mon code php mis à jour :
[php]<?php session_start(); ?>
<?php require_once("connexioninscription.inc.php"); ?>
<?php
$query=$bdd->prepare('SELECT artiste_id, titre_oeuvre, description_oeuvre, image_oeuvre, oeuvre_categorie, oeuvre_style, oeuvre_id, date_crea, date_edit FROM oeuvre_artiste');
if (empty($_SESSION['membre_id']))
{
echo '<p class="textewarning">'."vous devez vous connectez pour accéder à la publication oeuvre".'</p>';
}
else
{
echo '<form method="post" action="" enctype="multipart/form-data">
<legend><p class="textesimple"><b>Ajout d\'une oeuvre</b></p></legend>
<div id="encartpubldiv"><div id="encpubldiv"><label for="titre"><p class="textesimple">Titre : </label><input type="text" name="titre" id="oeuvretitre" placeholder="Choisissez un titre"/></p></div>
<legend><p class="textesimple"><b>Sélectionnez une oeuvre</b></p></legend>
<div id="encpubldiv"><label for="oeuvre"><p class="textesimple">Image : </label><input type="file" name="image_oeuvre"/></p></div>
<legend><p class="textesimple"><b>Décrivez votre oeuvre</b></p></legend>
<div id="encpubldiv"><label for="description"><p class="textesimple">Description : </label><textarea name="oeuvredescription" id="description" cols="40" rows="5" placeholder="Ecrivez une description de votre oeuvre ici !"></textarea></p></div>
<legend><p class="textesimple"><b>Classification</b></p></legend>
<div id="encpubldiv"><label for="categorie"><p class="textesimplesans">Catégorie : </label>
<select name="categorie" id="categorie">
<option value="peinture">Peinture</option>
<option value="croquis">Croquis</option>
<option value="dessin">Dessin</option>
<option value="graphe">Graphe</option>
<option value="autre">Autre...</option>
</select></p></div>
<div id="encpubldiv"><label for="style"><p class="textesimplesans">Style : </label>
<select name="style" id="style">
<option value="abstrait">Abstrait</option>
<option value="arturbain">Art urbain</option>
<option value="baroc">Baroc</option>
<option value="cubisme">Cubisme</option>
<option value="dadaisme">Dadaisme</option>
<option value="expressionnisme">Expressionnisme</option>
<option value="fauvisme">Fauvisme</option>
<option value="futurisme">Futurisme</option>
<option value="gothisme">Gothisme</option>
<option value="hyperrealisme">Hyperrealisme</option>
<option value="impressionnisme">Impressionnisme</option>
<option value="rococo">Rococo</option>
<option value="romantisme">Romantisme</option>
<option value="lettrisme">Lettrisme</option>
<option value="modernisme">Modernisme</option>
<option value="naturalisme">Naturalisme</option>
<option value="neoclassicisme">Néoclassicisme</option>
<option value="neogothique">Néogothique</option>
<option value="pointillisme">Pointillisme</option>
<option value="popart">Popart</option>
<option value="photorealisme">Photoréalisme</option>
<option value="postimpressionnisme">Postimpressionnisme</option>
<option value="surréalisme">Surréalisme</option>
<option value="symbolisme">Symbolisme</option>
<option value="autre">Autre...</option>
</select></p></div>
<legend><p class="textesimple"><b>Date de réalisation</b></p></legend>
<div id="encpubldiv"><label for="datecreaoeuvre"><p class="textesimple">Date de création : </label><input type="text" name="datecreaoeuvre" id="datecreaoeuvre" placeholder="AAAA-MM-JJ"/></p></div>
<input type="submit" name="envoyer" value="envoyer"/>
</div></form>';
if (isset($_POST['envoyer']))
{
if (!empty($_FILES))
{
$imgpublication=$_FILES['image_oeuvre'];
$ext = strtolower(pathinfo($imgpublication['image_oeuvre']['name'],PATHINFO_EXTENSION));
$allow_ext = array('jpg','png','gif','bmp','jpeg');
if (in_array($ext,$allow_ext))
{
move_uploaded_file($imgpublication['image_oeuvre']['tmp_name'],"images/oeuvres/".$imgpublication['image_oeuvre']['name']);
$id=($_SESSION['membre_id']);
$query1 = $bdd->prepare('UPDATE membres SET image_oeuvre=:oeuvre, oeuvre_id=:oid WHERE artiste_id=:id');
$query1->bindValue(':oeuvre',$imgpublication,PDO::PARAM_STR);
$query1->bindValue(':id',$id,PDO::PARAM_INT);
$query1->execute();
$query1->CloseCursor();
}
}
else
{
$erreurpublication = "Votre fichier contient une mauvaise extension, ou n'est pas une image.";
}
if (isset($erreurpublication))
{
echo $erreurpublication;
}
$titre = ($_POST['titre']);
$oeuvredescription = ($_POST['oeuvredescription']);
$style = ($_POST['style']);
$datecreaoeuvre = ($_POST['datecreaoeuvre']);
}
}
?>[/php]
Merci pour votre attention et votre aide ^^,
Sincèrement.