Facebook
From Perl Prairie Dog, 3 Years ago, written in PHP.
Embed
Download Paste or View Raw
Hits: 69
  1. <?php
  2. $OperateurId = @filter_input(INPUT_POST, 'OperateurId');
  3. $fixe = @filter_input(INPUT_POST, 'fixe');
  4. $mobile = @filter_input(INPUT_POST, 'mobile');
  5. $mo = @filter_input(INPUT_POST, 'mo');
  6.  
  7. include '../Pdo_start.inc.php';
  8. $pdo = pdo_connexion('natels');
  9.  
  10.  
  11. $sql_prepare = "SELECT `abonnement`.`IdAbonnement`, `abonnement`.`NomAbonnement`, `abonnement`.`OperateurId`, round((`abonnement`.`PrixMensuel` + `abonnement`.`CentimesMinuteFixeCh` * :fixe + `abonnement`.`CentimesMinuteMobileCh` * :mobile),2) AS 'Prix de consommation' ,`abonnement`.`DonneesMoInclus`
  12. FROM `abonnement` WHERE `abonnement`.`DonneesMoInclus` > :mo AND `abonnement`.`OperateurId` = :OperateurId";
  13. $pdo_prepare = $pdo->prepare($sql_prepare);
  14. $pdo_prepare->bindValue(":OperateurId", $OperateurId);
  15. $pdo_prepare->bindValue(":fixe", $fixe);
  16. $pdo_prepare->bindValue(":mobile", $mobile);
  17. $pdo_prepare->bindValue(":mo", $mo);
  18. $pdo_prepare->execute();
  19.  
  20. $tab_prepare = $pdo_prepare->fetchAll();
  21.  
  22. $liens = "";
  23.  
  24. if (count($tab_prepare) == 0) {
  25.     $liens .= "<a href='ref41.php'>Aucun abonnement ne correspond aux critères</a>";
  26. } else {
  27.     foreach ($tab_prepare as $row) {
  28.         $idAbo = $row['IdAbonnement'];
  29.         $liens .= "<a href='ref43.php?idAbo=$idAbo'>";
  30.         $liens .= $row['NomAbonnement'];
  31.         $liens .= " à ";
  32.         $liens .= $row['Prix de consommation'];
  33.         $liens .= " Fr/mois ";
  34.         $liens .= "</a>, ";
  35.     }
  36.     $liens = rtrim($liens, ", ");
  37. }
  38. ?>
  39. <!DOCTYPE html>
  40. <!--
  41. To change this license header, choose License Headers in Project Properties.
  42. To change this template file, choose Tools | Templates
  43. and open the template in the editor.
  44. -->
  45. <html>
  46.     <head>
  47.         <meta charset="UTF-8">
  48.         <title></title>
  49.     </head>
  50.     <body>
  51.  
  52.         <form>
  53.             <h1>D'après votre consomamtion, voici les abonnements les plus favorables</h1>
  54. <?= $liens ?>
  55.         </form>
  56.  
  57.  
  58.     </body>
  59. </html>

Replies to ref42.php rss

Title Name Language When
Re: ref43.php Tiny Rhinoceros php 3 Years ago.