Bonjour
J'ai un problème sur mon livre d'or : ICI http://www.anuresto.com/lavilla/index.html
La date est en format US.
Php/mysql n'étant pas du tout mon fort, pouvez vous m'aider afin de mettre celle-ci au format FR.
Voici mon php :
<?
$DBhost = "**********"; // Database Server
$DBuser = "**********"; // Database User
$DBpass = "**********"; // Database Pass
$DBName = "**********"; // Database Name
$table = "*********"; // Database Table
$numComments = 10; // Number of Comments per page
$DBConn = mysql_connect($DBhost,$DBuser,$DBpass) or die("Error in GuestBook Application: " . mysql_error());
mysql_select_db($DBName, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
switch($action) {
case 'read' :
$sql = 'SELECT * FROM `' . $table . '`';
$allComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
$numallComments = mysql_num_rows($allComments);
$sql .= ' ORDER BY `date` DESC LIMIT ' . $_GET['NumLow'] . ', ' . $numComments;
$fewComments = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
$numfewComments = mysql_num_rows($fewComments);
print '&totalEntries=' . $numallComments . '&';
print "<br>&entries=";
if($numallComments == 0) {
print "Pas de messages pour l'instant.";
} else {
while ($array = mysql_fetch_array($fewComments)) {
$nom = mysql_result($fewComments, $i, 'nom');
$email = mysql_result($fewComments, $i, 'email');
$message = mysql_result($fewComments, $i, 'message');
$date = mysql_result($fewComments, $i, 'date');
print '<b>Nom: </b>' . $nom . '<br><b>Email: </b>' . $email . '<br><b>Message: </b>' . $message . '<br><i>Date: ' . $date . '</i><br><br>';
$i++;
}
}
break;
case 'write' :
$nom = ereg_replace("&", "%26", $_POST['yourname']);
$email = ereg_replace("&", "%26", $_POST['youremail']);
$message = ereg_replace("&", "%26", $_POST['yourcomments']);
$submit = $_POST['submit'];
$submitted_on = date ("y-m-d H:i:s",time());
if($submit == 'Yes'){
// Insert the data into the mysql table
$sql = 'INSERT INTO ' . $table .
' (`ID`,
`nom`,
`email`,
`message`,
`date`
)
VALUES
(\'\','
. '\'' . $nom . '\','
. '\'' . $email . '\','
. '\'' . $message . '\','
. '\'' . $submitted_on . '\'
)';
$insert = mysql_query($sql, $DBConn) or die("Error in GuestBook Application: " . mysql_error());
print "&gb_status=La villa vous remercie.&done=yes&";
return;
}
print "&_root.write.gb_status=Error!&";
break;
}
?>
La table :
CREATE TABLE restolavilla (
ID int(5) NOT NULL auto_increment,
nom text NOT NULL,
email text NOT NULL,
message text NOT NULL,
`date` datetime NOT NULL default '00-00-0000 00:00:00',
PRIMARY KEY (ID)
)
Message édité par primoweb le 14-02-2007 à 22:26:42