Advertisement
Benlahbib_Abdessamad

Untitled

Jun 28th, 2015
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. function getConnection()
  2. {
  3. $bdd=new PDO('mysql:host:localhost;dbname=test;"root",""');
  4. return $bdd;
  5. }
  6.  
  7.  
  8.  
  9. function getAllArticles()
  10. {
  11. $rq="select * from Article";
  12. $resultat=getConnection()->query($rq);
  13. return $resultat;
  14. }
  15.  
  16.  
  17. function getArticle($articleCode)
  18. {
  19. $rq="select * from Article where idArticle= " . $articleCode . " ";
  20. $resultat=$resultat=getConnection()->exec($rq);
  21. return $resultat;
  22. }
  23.  
  24. function getComments()
  25. {
  26. $rq="select * from Commentaire";
  27. $resultat=getConnection()->query($rq);
  28. return $resultat;
  29. }
  30.  
  31. function insertComment($comm)
  32. {
  33. $rq="insert into Commentaire values ( " . $comm["idCommentaire"] . " , " . $comm["idArticle"] . " , '" . $comm["commentaireContenu"] . "' , '" . $comm["dateheure"] . "' , '" . $comm["pseudo"] . "' ) " ;
  34. getConnection()->exec($rq);
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement