It is currently Mon Oct 07, 2024 1:29 pm


All times are UTC


Forum rules


Please click here to view the forum rules



Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: Update problem
PostPosted: Fri Aug 18, 2006 4:46 am 
Noobie
Noobie

Joined: Fri Aug 18, 2006 4:32 am
Posts: 1
The problem is when I want to update a date field.

I've created a database and when I Insert data, I have no problem. But when it comes to updating date fields, it doesn't work. The date always reset to the default (0000-00-00). I don't understand why because the format of the updated date is correct (eg 2006-01-01).

here's my code

Quote:
<?php
include("connection.php");

$resultats = mysql_query("SELECT ID,Titre,Date,Auteur,Email,Texte FROM nouvelle WHERE ID=$_GET[id]");
while ($row = mysql_fetch_array($resultats))
{
?>

<html>
<head>
<title>formulaire</title>
<head>
<body>
Pour modifier :<br>
<form method="post" action="update_nouvelles.php">
Titre : <input type="text" name="titre" value="<?php echo $row['Titre']?>"><br>
Date: <input type="text" name="date" value="<?php echo $row['Date']?>"><br>
Auteur : <input type="text" name="auteur" value="<?php echo $row['Auteur']?>"><br>
Email : <input type="text" name="email" value="<?php echo $row['Email']?>"><br>
Texte : <Textarea name="texte"><?php echo $row['Texte']?></textarea>
<input type="hidden" name="id" value="<?php echo $row['ID']?>"><br>
<input type="submit" name="submit" value="Valider">
</form>
</body>
</html>

<?php
}

include("disconnection.php");
?>


Quote:
<?php
include("connection.php");


mysql_query("UPDATE nouvelle SET Titre=$titre, Date=$date, Auteur=$auteur, Email=$email, Texte=$texte WHERE ID=$id");

echo "Les modifications ont été apportées avec succès.<br><br>";
echo "Titre: " . $titre . "<br>";
echo "Date: " . $date . "<br>";
echo "Auteur: " . $auteur . "<br>";
echo "Email: " . $email . "<br>";
echo "Texte: " . $texte . "<br>";

include("disconnection.php");
?>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ]  Moderators: fhmagic, KJ, Moderators, Support Team

All times are UTC


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
100WebSpace © 2011