Advertisement
xakepabg

HTML Table / PHP Loop

Jun 13th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.64 KB | None | 0 0
  1. <?php
  2.     $conn = mysqli_connect('localhost', 'root', 'passwd', 'kino');
  3.     if (!$conn) {
  4.         echo mysqli_error($conn);
  5.     }
  6.  
  7.     mysqli_set_charset($conn, 'utf8');
  8.    
  9.    
  10.     $getAllFilms = mysqli_query($conn, "SELECT * FROM films");
  11.     $getAllProj = mysqli_query($conn, "SELECT * FROM date_proj LIMIT 7");
  12.  
  13. ?>
  14.  
  15. <!doctype html>
  16.  
  17. <html lang="bg">
  18.     <head>
  19.         <meta charset="utf-8">
  20.  
  21.         <title>Кино - Royal Мездра</title>
  22.         <meta name="description" content="кино,филми,films,kino">
  23.         <meta name="autdor" content="Toshko Tan`ew">
  24.         <link href="css/bootstrap.css" rel="stylesheet" type="text/css"/>
  25.         <script src="js/bootstrap.js" type="text/javascript"></script>
  26.         <!--[if lt IE 9]>
  27.           <script src="https://cdnjs.cloudflare.com/ajax/libs/html5shiv/3.7.3/html5shiv.js"></script>
  28.         <![endif]-->
  29.         <style type="text/css">
  30.             .price {
  31.                 line-height: 5px;
  32.                 min-height: 5px;
  33.                 height: 5px;
  34.             }
  35.  
  36.             .fixed{
  37.                 width: 50%;
  38.             }
  39.         </style>
  40.     </head>
  41.     <body>
  42.  
  43.         <table class="table table-striped table-dark">
  44.             <thead>
  45.             <tr>
  46.                 <th></th>
  47.                 <?php
  48.                 while ($filmNames = mysqli_fetch_array($getAllFilms)) {
  49.                     echo '<th>'.$filmNames['film_name'].'</th>';
  50.                 }
  51.                 ?>
  52.             </tr>
  53.             </thead>
  54.             <tbody>
  55.                 <tr>
  56.                     <th>Price</th>
  57.                     <?php
  58.                         while ($filmPrice = mysqli_fetch_array($getAllFilms)){
  59.                             echo '<th>'.$filmPrice['film_price'].'</th>';
  60.                         }
  61.                     ?>
  62.                 </tr>
  63.             </tbody>
  64.         </table>
  65.  
  66.  
  67.     </table>
  68. </div>
  69. </body>
  70. </html>
  71.  
  72. <?php
  73. /*
  74.   header('Content-Type: text/html; charset=UTF-8');
  75.   $weekModifier = 0;
  76.  
  77.   $locale = 'bg_BG.utf8';
  78.   setlocale(LC_ALL, $locale);
  79.  
  80.   $date = new DateTime();
  81.  
  82.   if($date->format('N') !== 1) {
  83.   $date->sub(new DateInterval('P'. $date->format('N') . 'D'));
  84.   }
  85.  
  86.   $interval = new DateInterval('P'.abs($weekModifier).'W');
  87.  
  88.   if($weekModifier > 0) {
  89.   $date->add($interval);
  90.   } else {
  91.   $date->sub($interval);
  92.   }
  93.  
  94.   for($i = 1; $i <= 7; $i++) {
  95.   echo $date->add(new DateInterval('P1D'))->format('l d-m-Y') . "<br>\n";
  96.   }
  97.  *
  98.  *
  99.  *
  100.  * 'SELECT films.film_id,films.film_name,films.film_price,
  101.   date_proj.f_id,date_proj.time_proj,date_proj.dates_proj
  102.   FROM films RIGHT JOIN date_proj'
  103.  */
  104. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement