diff options
Diffstat (limited to 'public')
-rw-r--r-- | public/index.php | 40 | ||||
-rw-r--r-- | public/w/index.php | 56 |
2 files changed, 74 insertions, 22 deletions
diff --git a/public/index.php b/public/index.php index 90df7d7..9b8a61b 100644 --- a/public/index.php +++ b/public/index.php @@ -4,22 +4,48 @@ <?php -var_dump(__FILE__); +try +{ + $bdd = new PDO('mysql:host=localhost;dbname=wcms;charset=utf8', 'root', ''); +} +catch(Exception $e) +{ + die('Erreur : '.$e->getMessage()); +} -$htdocs = str_replace(basename(__FILE__), __FILE__, ''); +// $reponse = $bdd->query('SELECT nom, age FROM art2 WHERE nom = \'eddie\''); -var_dump($htdocs); +// while ($donnees = $reponse->fetch()) +// { +// echo $donnees['nom'] . ' a ' . $donnees['age'] . ' ANS<br />'; +// } -var_dump($_SERVER["DOCUMENT_ROOT"]); +// $reponse->closeCursor(); +// $req = $bdd->prepare('SELECT nom, age FROM art2 WHERE age = 23 '); +// $req->execute(array($_GET['possesseur'], $_GET['prix_max'])); -set_include_path('e:/WEB/wcms'); +// echo '<ul>'; +// while ($donnees = $req->fetch()) +// { +// echo '<li>' . $donnees['nom'] . ' (' . $donnees['prix'] . ' EUR)</li>'; +// } +// echo '</ul>'; -echo get_include_path(); +// $req->closeCursor(); +$req = $bdd->prepare('SELECT * FROM art WHERE id = :id '); +$req->execute(array('id' => 'articlet')); +echo '<ul>'; +while ($donnees = $req->fetch()) +{ + echo '<li>' . $donnees['titre'] . ' (' . $donnees['id'] . ' ANS)</li>'; +} +echo '</ul>'; + +$req->closeCursor(); -include('fn/fn.php'); ?>
\ No newline at end of file diff --git a/public/w/index.php b/public/w/index.php index 85c0902..4d28510 100644 --- a/public/w/index.php +++ b/public/w/index.php @@ -8,7 +8,7 @@ require('fn/fn.php'); require('class/class.art.php'); require('class/class.app.php'); $config = include('config.php'); -$app = new App(); +$app = new App($config); session(); @@ -26,6 +26,25 @@ head('article'); // 'datemodif' => new DateTimeImmutable(null, timezone_open("Europe/Paris")) // ]); +$arraytest = ([ + 'id' => 'articlet2', + 'titre' => 'titre', + 'soustitre' => 'soustitre', + 'intro' => 'intro', + 'tag' => 'sans tag,', + 'datecreation' => '2018-03-17 18:31:34', + 'datemodif' => '2018-03-17 18:31:34', + 'css' => 'display: inline:', + 'html' => 'coucou les loulous', + 'secure' => 0, + 'couleurtext' => '#000000', + 'couleurbkg' => '#ffffff', + 'couleurlien' => '#2a3599' +]); + +// $art = new Art($arreytest); + + // echo '<pre>'; // print_r($art); // print_r($app); @@ -37,25 +56,32 @@ head('article'); // echo '<p>article exist :' . $app->exist('articlet') . '</p>'; // var_dump($app->exist('articlet')); -// $app->get('articlet'); -// echo '<pre>'; -// print_r($art); -// print_r($app); -// echo '</pre>'; -try { - $bdd = new PDO('mysql:host=localhost;dbname=wcms;charset=utf8', 'root', ''); -} catch (Exeption $e) { - die('Erreur : ' . $e->getMessage()); -} +echo '<pre>'; +$art = $app->get('articlet'); + +var_dump($art); + +echo 'count : ' . $app->count(); + + var_dump($app->exist('bouffffe')); + var_dump($app->exist('bouffe')); + + + $art2 = new Art($arraytest); + +// $app->add($art2); + +$app->update($art2); + +var_dump($app->getlist()); + +echo '</pre>'; + -$q = $bdd->query('SELECT * FROM art WHERE id = articlet'); -$donnees = $q->fetch(); -var_dump($donnees); -$q = closeCursor(); |