karlokokkak

Untitled

Mar 28th, 2018
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   <?php
  2. include_once "../konfiguracija.php";
  3. include 'includes/head.php';
  4. include 'includes/izbornik.php';
  5. //Restore Product
  6. if(isset($_GET['restore'])) {
  7.  $id = sanitize($_GET['restore']);
  8.  $restorirana=$veza->prepare("UPDATE products SET deleted = 0 WHERE id='$id';");
  9.  $restorirana->execute();
  10.  print_r( $_GET ); exit;
  11.  header('Location: Products.php');
  12. }
  13. ?>
  14. <?php
  15. $format = new NumberFormatter("en_US",NumberFormatter::CURRENCY);
  16. $p_result =$veza->prepare( "SELECT * FROM `products` WHERE `deleted`=1;");
  17. $p_result ->execute();
  18. ?>
  19. <h2 class="text-center">Products</h2>
  20. <div class="clearfix"></div>
  21. <hr>
  22. <table class="table table-bordered table-condensed talbe-striped">
  23.  <thead>
  24.    <th>Restore</th>
  25.    <th>Product</th>
  26.    <th>Price</th>
  27.    <th>Parent ~ Category</th>
  28.    <th>Featured</th>
  29.    <th>Sold</th>
  30.  </thead>
  31.  <tbody>
  32.     <?php while ($product = $p_result->fetch(PDO::FETCH_ASSOC)):
  33.       $childId = $product['categories'];
  34.        $catSql = $veza->prepare("SELECT * FROM categories WHERE id='$childId';");
  35.        $result= $catSql->execute();
  36.        $child = $catSql->fetch(PDO::FETCH_ASSOC);
  37.        $parentId = $child['parent'];
  38.          $parentSql = $veza->prepare("SELECT * FROM categories WHERE id='$parentId';");
  39.         $parentSql->execute();
  40.          $parent =$parentSql->fetch(PDO::FETCH_ASSOC);
  41.          $category = $parent['category'].'~'.$child['category'];
  42.    ?>
  43.     <tr>
  44.      <td>
  45.       <a href="products.php?restore=<?php echo $product['id']; ?>" class ="button"><i class="fas fa-undo"></i></a>
  46.     </td>
  47.     <td><?=$product['title'];?></td>
  48.     <td><?php echo $format->format ($product['price']); ?></td>
  49.     <td><?php echo $category;?></td>
  50.     <td><a href="products.php?featured=<?=(($product['featured']== 0)?'1':'0');?>&id=<?=$product['id'];?>"
  51.       class ="button tiny"><i class="fas fa-<?=(($product['featured']==1)?'minus':'plus');?> fa-2x " ></i>
  52.     </a>&nbsp <?=(($product['featured']==1)?'Featured Product': '');?></td>
  53.     <td>0</td>
  54.  </tr>
  55. <?php endwhile; ?>
  56.  </tbody>
  57. </table>
  58. <?php include 'includes/podnozje.php';
  59. include_once 'includes/scripts.php';
  60.  ?>*
Add Comment
Please, Sign In to add comment