Page 341 - MDP2022-2
P. 341

<h4  class="mbr-section-title  mbr-fonts-style  align-center  mb-0
            display-2"><strong>Freshness</strong>
                            </h4>
                        </div>
                        <table>
                            <thead>
                                <tr>
                                    <th>name</th>
                                    <th>type</th>
                                    <th>구입  날짜</th>
                                    <th>신선도</th>
                                    <th>  </th>
                                </tr>
                            </thead>
                            <tbody>
                                <?php
                                include_once("connection.php");


                                $sql  =  "SELECT  *  FROM  material";


                                $result  =  mysqli_query($connect,  $sql);

                                if  ($result  ===  false)  {
                                    echo  '저장하는  과정에서  문제가  생겼습니다.  관리자에게  문의해주세요';
                                    error_log(mysqli_error($conn));
                                }  else  if  (isset($result)  &&  $result->num_rows  >  0)  {
                                    while  ($row  =  mysqli_fetch_array($result))  {
                                        date_default_timezone_set('Asia/Seoul');
                                        $from  =  new  DateTime($row['date']);
                                        $to  =  new  DateTime($row['last_date']);
                                        $now  =  new  DateTime(date("Y-m-d"));
                                        $date  =  date_diff($from,  $to)->days;
                                        $now_date  =  date_diff($from,  $now)->days;
                                        echo  '<tr>
                                        <td>'  .  $row['food_name']  .  '</td>
                                        <td>'  .  $row['food_type']  .  '</td>
                                        <td>'  .  $row['date']  .  '</td>
                                        <td><progress  value="'.  ($date-$now_date)  .  '"  max="'.  $date  .'"></progress></td>
                                        <td><form  action="delete.php"  method="post">
                                        <input  type="hidden"  name="name"  value="'.$row['food_name'].'">
                                        <input  type="submit"  name="delete"  value="X"  style="border:none;
            background-color:#ffffff;"></form></td>
                                        </tr>';
                                    }
                                }
                                ?>
                            </tbody>
   336   337   338   339   340   341   342   343   344   345   346