Forums ProgMatique Forum Index Forums ProgMatique
Programmation (C/C++, JAVA, PHP, JavaScript, ...) et Informatique (Webmaster, Web)
Retour au site Progmatique

crée forum

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Forums ProgMatique Forum Index » Programmation » Php / MySQL
Previous topic :: Next topic  
Author Message
max1395


Offline


Joined: 05 Dec 2008
Posts: 8


PostPosted: Tue 9 Dec 2008 - 11:14    Post subject: crée forum Reply with quote

bonjour
je voudrais crée un forum mais j'ai un petit probleme c'est que quand j'essays sa me mais ERROR et sa n'enregistre pas les données . voici mon code
Code:

<?php

// Connect to server and select database.
mysql_connect("localhost", "root", "")or die("cannot connect");
mysql_select_db("ml")or die("cannot select DB");

// get data that sent from form
$topic=$_POST['topic'];
$detail=$_POST['detail'];
$name=$_POST['name'];
$email=$_POST['email'];

$datetime=date("d/m/y h:i:s"); //create date time

$sql="INSERT INTO forum(topic, detail, name, email, datetime)VALUES('$topic', '$detail', '$name', '$email', '$datetime')";
$result=mysql_query($sql);

if($result){
echo "Successful<BR>";
echo "<a href=main_forum.php>View your topic</a>";
}
else {
echo "ERROR";
}
mysql_close();
?>
 
[/code]
Back to top
Simon
Administrateur
Administrateur

Offline


Joined: 08 May 2005
Posts: 954
Localisation: France


PostPosted: Tue 9 Dec 2008 - 13:15    Post subject: crée forum Reply with quote

Bonjour,
peut tu afficher la structure de la BD svp
_________________
Simon (SimMaster),
Programmation et informatique
Colorisation syntaxique de codes sources
Outils et services autour de l'adresse IP
Back to top
Visit poster’s website
max1395


Offline


Joined: 05 Dec 2008
Posts: 8


PostPosted: Tue 9 Dec 2008 - 13:25    Post subject: crée forum Reply with quote

voila

-- phpMyAdmin SQL Dump
-- version 2.9.2
-- http://www.phpmyadmin.net
--
-- Serveur: localhost
-- Généré le : Mardi 09 Décembre 2008 à 13:25
-- Version du serveur: 5.0.27
-- Version de PHP: 5.2.1
--
-- Base de données: `ml`
--

-- --------------------------------------------------------

--
-- Structure de la table `forum`
--

CREATE TABLE `forum` (
`topic` text NOT NULL,
`detail` text NOT NULL,
`name` text NOT NULL,
`email` text NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

--
-- Contenu de la table `forum`
--
Back to top
Simon
Administrateur
Administrateur

Offline


Joined: 08 May 2005
Posts: 954
Localisation: France


PostPosted: Tue 9 Dec 2008 - 13:37    Post subject: crée forum Reply with quote

Modifie le echo "Error" par echo "mysql_error(); "
Dans ta structure de table, tu n'a pas le champ datatime
_________________
Simon (SimMaster),
Programmation et informatique
Colorisation syntaxique de codes sources
Outils et services autour de l'adresse IP
Back to top
Visit poster’s website
max1395


Offline


Joined: 05 Dec 2008
Posts: 8


PostPosted: Tue 9 Dec 2008 - 13:42    Post subject: crée forum Reply with quote

sa m'affiche une page banche
Back to top
Simon
Administrateur
Administrateur

Offline


Joined: 08 May 2005
Posts: 954
Localisation: France


PostPosted: Tue 9 Dec 2008 - 19:01    Post subject: crée forum Reply with quote

Et ça :
Code:
echo "<b>Erreur " . mysql_errno() . ": " . mysql_error() . "</b>";

_________________
Simon (SimMaster),
Programmation et informatique
Colorisation syntaxique de codes sources
Outils et services autour de l'adresse IP
Back to top
Visit poster’s website
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Forums ProgMatique Forum Index » Programmation » Php / MySQL All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  

Index | Create a forum | Free support forum | Free forums directory | Report a violation | Conditions générales d'utilisation
Powered by phpBB v2 © 2001, 2005 phpBB Group ¦ Theme: subSilver++