probleme affichage

Eléphanteau du PHP | 42 Messages

02 sept. 2006, 11:09

Salut tout le monde,
Donc voila j'ai crée un script ou on entre des informations, et quand je demande a voir ces info rien ne s'affiche :?

Page formulaire :
<?
require("admin/ad_conf.inc.php");


if (!empty($_POST['mail']) AND !empty($_POST['titre']) AND !empty($_POST['theme']) AND !empty($_POST['couleur']) AND !empty($_POST['img1']) AND !empty($_POST['img2']) AND !empty($_POST['img3']) AND !empty($_POST['img4']) AND !empty($_POST['admin']) AND !empty($_POST['description'])) // Si les variables existent
{
    if ($_POST['mail'] != NULL AND $_POST['titre'] != NULL AND $_POST['theme'] != NULL AND $_POST['couleur'] != NULL AND $_POST['img1']  != NULL AND $_POST['img2']  != NULL AND $_POST['img3']  != NULL AND $_POST['img4']  != NULL AND $_POST['admin']  != NULL AND $_POST['description'] != NULL) // Si on a quelque chose à enregistrer
    {
        mysql_connect("$host", "$user", "$mdp");
        mysql_select_db("$user");     
        
        $mail = htmlentities ($_POST['mail']);
        $titre = htmlentities ($_POST['titre']);
        $theme = htmlentities ($_POST['theme']);
        $couleur = htmlentities ($_POST['couleur']);
        $img1 = htmlentities ($_POST['img1']);
        $img2 = htmlentities ($_POST['img2']);
        $img3 = htmlentities ($_POST['img3']);
        $img4 = htmlentities ($_POST['img4']);
        $admin = htmlentities ($_POST['admin']);
        $description = htmlentities ($_POST['description']);
         
        mysql_query("INSERT INTO kit VALUES('', '$mail', '$titre', '$theme', '$couleur', '$img1', '$img2', '$img3', '$img4', '$admin', '$description',)");
        mysql_close();
        }
}
?>

<small>(*)<i>Réponce obligatoire !!!</i></small><br>
<form method="POST" action="v_kit.php">
*Mail:<br>
<input type="TEXT" size="50" name ="mail">
<br><br>
*Titre du site:<br>
<input type="TEXT" size="50" name ="titre">
<br><br>
*Thème(s):<br>
<input type="TEXT" size="50" name ="theme">
<br><br>
*Couleur(s):<br>
<input type="TEXT" size="50" name ="couleur">
<br><br>
Image(s):<br>
1. <input type="TEXT" size="50" name ="img1">
<br>
2. <input type="TEXT" size="50" name ="img2">
<br>
3. <input type="TEXT" size="50" name ="img3">
<br>
4. <input type="TEXT" size="50" name ="img4">
<br><br>
*Partie Admin:<br>
<input type="TEXT" size="50" name ="admin"> <small><i>Répondre par <b>OUI</b> ou <b>NON</b>.</i></small>
<br><br>
Description:<br>
<textarea name="description" rows="8" cols="35"></textarea>
<br><br><br>
<input type="SUBMIT" value="OK"></form>
<br><br>
<small><i>La partie administration comprend, un système de statisque, de création de menu, de création de lien partenaire, un système d'article.</i>

La BDD SQL :

Code : Tout sélectionner

CREATE TABLE `kit` ( `id` int(11) NOT NULL auto_increment, `titre` varchar(255) NOT NULL default '', `theme` text NOT NULL default '', `couleur` text NOT NULL default '', `police` text NOT NULL default '', `img1` text NOT NULL default '', `img2` text NOT NULL default '', `img3` text NOT NULL default '', `img4` text NOT NULL default '', `admin` text NOT NULL default '', `description` text NOT NULL default '', PRIMARY KEY (`id`) ) TYPE=MyISAM AUTO_INCREMENT=1 ;
Page Affichage:
<?
require("admin/ad_conf.inc.php");


        mysql_connect("$host", "$user", "$mdp");
        mysql_select_db("$user"); 


$retour = mysql_query('SELECT * FROM kit ORDER BY id DESC');
while ($donnees = mysql_fetch_array($retour))
{
?>
Votre mail : <font color="#009900"><? echo $donnees['mail']; ?><br></font>
Le titre de votre site : <font color="#009900"><? echo $donnees['titre']; ?><br></font>
Le(s) thème(s) : <font color="#009900"><? echo $donnees['theme']; ?><br></font>
La/Le(s) couleur(s) : <font color="#009900"><? echo $donnees['couleur']; ?><br></font>
Image(s):<br>
1.<? echo $donnees['img1']; ?><br>
2.<? echo $donnees['img2']; ?><br>
3.<? echo $donnees['img3']; ?><br>
4.<? echo $donnees['img4']; ?><br>
Partie Admin : <font color="#009900"><? echo $donnees['admin']; ?><br></font>
Description : <font color="#009900"><? echo $donnees['description']; ?><br></font>

<?
}
// Fin de la boucle, le script est terminé !
?>

<br><br>

<a href="index.php" border="0" class="valid"> Continuer >></a>

Avatar du membre
ViPHP
ViPHP | 3008 Messages

02 sept. 2006, 11:12

L'insertion en base se fait-elle correctement ?

Enlèves déjà la dernire virgule :
mysql_query("INSERT INTO kit VALUES('', '$mail', '$titre', '$theme', '$couleur', '$img1', '$img2', '$img3', '$img4', '$admin', '$description')");

Invité
Invité n'ayant pas de compte PHPfrance

02 sept. 2006, 14:46

sa na pas l'air de changer sans la virgule.
L'insertion en base se fait-elle correctement ?
c'est à dir ?

Eléphanteau du PHP | 42 Messages

02 sept. 2006, 17:39

dsl javais pas vu ke jété pas loggué :)

Avatar du membre
ViPHP
ViPHP | 3008 Messages

02 sept. 2006, 18:31

Le bug provient d'où exactement ?

Le INSERT fonctionne bien et tu as toutes les données dans ta base ?

C'est donc juste la page d'affichage qui a un souci ?

Invité
Invité n'ayant pas de compte PHPfrance

02 sept. 2006, 22:04

j'ai éffectivement vérifié la BDD SQL est vide alors que les table est bonne :cry:

ViPHP
ViPHP | 2291 Messages

02 sept. 2006, 22:24

('', '$mail', '$titre', '$theme', '$couleur', '$img1', '$img2', '$img3', '$img4', '$admin', '$description',)"); 
CREATE TABLE `kit` (
`id` int(11) NOT NULL auto_increment,
`mail` varchar(255) NOT NULL default '', <---- :!:
`titre` varchar(255) NOT NULL default '',
`theme` text NOT NULL default '',
`couleur` text NOT NULL default '',
`police` text NOT NULL default '', <------ :?:
`img1` text NOT NULL default '',
`img2` text NOT NULL default '',
`img3` text NOT NULL default '',
`img4` text NOT NULL default '',
`admin` text NOT NULL default '',
`description` text NOT NULL default '',
PRIMARY KEY (`id`)
) TYPE=MyISAM AUTO_INCREMENT=1 ;
j'ai éffectivement vérifié la BDD SQL est vide alors que les table est bonne
Tu a oublier le champ mail dans ta table ?
et le champ police correspond à quoi ?
ImageCe que l'on apprend par l'effort reste toujours ancré beaucoup plus longtemps.

Invité
Invité n'ayant pas de compte PHPfrance

03 sept. 2006, 10:48

Tu a oublier le champ mail dans ta table ?
et le champ police correspond à quoi ?
voi c'est rectifié je vais voir si sa marche :)

Eléphanteau du PHP | 42 Messages

03 sept. 2006, 11:05

cela ne marche toujours pas.
Il n'y a rien dans la BDD :s

Avatar du membre
ViPHP
ViPHP | 3008 Messages

03 sept. 2006, 11:08

Qu'as tu fais comme modif ?

Tu as bien rajouté dans ta table le champ mail et rajouté le champ couleur dans la ligne d'insertion ?
('', '$mail', '$titre', '$theme', '$couleur', '$police', '$img1', '$img2', '$img3', '$img4', '$admin', '$description')");

Eléphanteau du PHP | 42 Messages

03 sept. 2006, 15:49

Oui j'ai bien tout remi

voila la table sorti direct de mysql:

Code : Tout sélectionner

-- phpMyAdmin SQL Dump -- version 2.6.3-pl1 -- http://www.phpmyadmin.net -- -- Serveur: br.team.sql.free.fr -- Généré le : Dimanche 03 Septembre 2006 à 15:48 -- Version du serveur: 5.0.25 -- Version de PHP: 4.4.4 -- -- Base de données: `br_team` -- -- -------------------------------------------------------- -- -- Structure de la table `kit` -- CREATE TABLE `kit` ( `id` int(11) NOT NULL auto_increment, `titre` varchar(255) collate latin1_general_ci NOT NULL default '', `theme` text collate latin1_general_ci NOT NULL, `couleur` text collate latin1_general_ci NOT NULL, `police` text collate latin1_general_ci NOT NULL, `img1` text collate latin1_general_ci NOT NULL, `img2` text collate latin1_general_ci NOT NULL, `img3` text collate latin1_general_ci NOT NULL, `img4` text collate latin1_general_ci NOT NULL, `admin` text collate latin1_general_ci NOT NULL, `description` text collate latin1_general_ci NOT NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ; -- -- Contenu de la table `kit`

Avatar du membre
ViPHP
ViPHP | 3008 Messages

03 sept. 2006, 16:47

Heu...heu...je ne vois toujours pas le champ "mail"...La structure de la table n'a pas du tout changé.

Eléphanteau du PHP | 42 Messages

06 sept. 2006, 16:17

-- 
-- Structure de la table `kit`
-- 

CREATE TABLE `kit` (
  `id` int(11) NOT NULL auto_increment,
  `titre` varchar(255) collate latin1_general_ci NOT NULL default '',
  `mail` varchar(255) collate latin1_general_ci NOT NULL default '',
  `theme` text collate latin1_general_ci NOT NULL,
  `couleur` text collate latin1_general_ci NOT NULL,
  `police` text collate latin1_general_ci NOT NULL,
  `img1` text collate latin1_general_ci NOT NULL,
  `img2` text collate latin1_general_ci NOT NULL,
  `img3` text collate latin1_general_ci NOT NULL,
  `img4` text collate latin1_general_ci NOT NULL,
  `admin` text collate latin1_general_ci NOT NULL,
  `description` text collate latin1_general_ci NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci AUTO_INCREMENT=1 ;

-- 
-- Contenu de la table `kit` 
ca ne marche toujours pas :?:

Avatar du membre
ViPHP
ViPHP | 3008 Messages

06 sept. 2006, 16:26

On a maintenant la structure finale. Montres nous ton code d'insertion pour finir. On va pouvoir trouver ton souci.

Eléphanteau du PHP | 42 Messages

07 sept. 2006, 19:28

Le formulaire
<table valign="top">
	<tr>
<td valign="top"><img src="images/crea.png" alt=""></td>
<td valign="top">
<?
require("admin/ad_conf.inc.php");


if (!empty($_POST['mail']) AND !empty($_POST['titre']) AND !empty($_POST['theme']) AND !empty($_POST['couleur']) AND !empty($_POST['police']) AND !empty($_POST['img1']) AND !empty($_POST['img2']) AND !empty($_POST['img3']) AND !empty($_POST['img4']) AND !empty($_POST['admin']) AND !empty($_POST['description'])) // Si les variables existent
{
    if ($_POST['mail'] != NULL AND $_POST['titre'] != NULL AND $_POST['theme'] != NULL AND $_POST['couleur'] != NULL AND $_POST['police'] != NULL AND $_POST['img1']  != NULL AND $_POST['img2']  != NULL AND $_POST['img3']  != NULL AND $_POST['img4']  != NULL AND $_POST['admin']  != NULL AND $_POST['description'] != NULL) // Si on a quelque chose à enregistrer
    {
        mysql_connect("$host", "$user", "$mdp");
        mysql_select_db("$user");     
        
        $mail = htmlentities ($_POST['mail']);
        $titre = htmlentities ($_POST['titre']);
        $theme = htmlentities ($_POST['theme']);
        $couleur = htmlentities ($_POST['couleur']);
        $police = htmlentities ($_POST['police']);
        $img1 = htmlentities ($_POST['img1']);
        $img2 = htmlentities ($_POST['img2']);
        $img3 = htmlentities ($_POST['img3']);
        $img4 = htmlentities ($_POST['img4']);
        $admin = htmlentities ($_POST['admin']);
        $description = htmlentities ($_POST['description']);
         
        mysql_query("INSERT INTO kit VALUES('', '$mail', '$titre', '$theme', '$couleur', '$police', '$img1', '$img2', '$img3', '$img4', '$admin', '$description')");
        mysql_close();
        }
}
?>

<small>(*)<i>Réponce obligatoire !!!</i></small><br>
<form method="POST" action="v_kit.php">
*Mail:<br>
<input type="TEXT" size="50" name ="mail">
<br><br>
*Titre du site:<br>
<input type="TEXT" size="50" name ="titre">
<br><br>
*Thème(s):<br>
<input type="TEXT" size="50" name ="theme">
<br><br>
*Couleur(s):<br>
<input type="TEXT" size="50" name ="couleur">
<br><br>
Police:<br>
<input type="TEXT" size="50" name ="police">
<br><br>
Image(s):<br>
1. <input type="TEXT" size="50" name ="img1">
<br>
2. <input type="TEXT" size="50" name ="img2">
<br>
3. <input type="TEXT" size="50" name ="img3">
<br>
4. <input type="TEXT" size="50" name ="img4">
<br><br>
*Partie Admin:<br>
<input type="TEXT" size="50" name ="admin"> <small><i>Répondre par <b>OUI</b> ou <b>NON</b>.</i></small>
<br><br>
Description:<br>
<textarea name="description" rows="8" cols="35"></textarea>
<br><br><br>
<input type="SUBMIT" value="OK"></form>
<br><br>
<small><i>La partie administration comprend, un système de statisque, de création de menu, de création de lien partenaire, un système d'article.</i>
</td>
	</tr>
</table>

Le fichier de résultat :
<?
require("admin/ad_conf.inc.php");


        mysql_connect("$host", "$user", "$mdp");
        mysql_select_db("$user"); 


$retour = mysql_query('SELECT * FROM kit ORDER BY id DESC');
while ($donnees = mysql_fetch_array($retour))
{
?>
Votre mail : <font color="#009900"><? echo $donnees['mail']; ?><br></font>
Le titre de votre site : <font color="#009900"><? echo $donnees['titre']; ?><br></font>
Le(s) thème(s) : <font color="#009900"><? echo $donnees['theme']; ?><br></font>
La/Le(s) couleur(s) : <font color="#009900"><? echo $donnees['couleur']; ?><br></font>La police : <font color="#009900"><? echo $donnees['police']; ?><br></font>
Image(s):<br>
1.<? echo $donnees['img1']; ?><br>
2.<? echo $donnees['img2']; ?><br>
3.<? echo $donnees['img3']; ?><br>
4.<? echo $donnees['img4']; ?><br>
Partie Admin : <font color="#009900"><? echo $donnees['admin']; ?><br></font>
Description : <font color="#009900"><? echo $donnees['description']; ?><br></font>

<?
}
// Fin de la boucle, le script est terminé !
?>