1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
<?php echo $_POST['editor1']; ?>
<?php
try
{
$bdd = new PDO('mysql:host=localhost;dbname=news', 'root', '');
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
// on prépare notre requête
$var2=$bdd->prepare("CREATE TABLE if not exists fckeditor (
id tinyint(4) unsigned NOT NULL auto_increment,
editor1 text NOT NULL,
PRIMARY KEY (id)
)") or die(print_r($bdd->errorInfo()));
//on l'execute
$var2->execute();
$var2->closeCursor();
if (isset($_POST['editor1']))
{
$editor = htmlentities($_POST['editor1']);
// C'est une modification, on met juste à jour le contenu
// On vérifie d'abord s'il n'y a pas de champ vide
$var=$bdd->prepare("UPDATE fckeditor SET editor1 ='" . $editor . "' WHERE id= 1") or die(print_r($bdd->errorInfo()));
$var->execute();
}
$var->closeCursor();
//deconnexion à la base de donnée
$bdd = null;
?> |