<?php 

include "../db.php";

session_start();

if (isset($_POST['h_ref'])) 

{

 		

	$img_sql = "SELECT * FROM homework_img  WHERE hi_ref = '$_POST[h_ref]' ORDER BY hi_pos ASC";

    $img_res = mysqli_query($con,$img_sql);

    if ($img_total_rows=mysqli_num_rows($img_res)>0) {

        while ($img_row=mysqli_fetch_assoc($img_res)) {

            $img_path = "../upload/homework_submit/";

            $img_sl = $img_row['hi_sl'];

            $img_name = $img_row['hi_name'];

            $img_pos=$img_row['hi_pos'];



            if (!empty($img_row['hi_editDT'])) {

                $dt = 'Edit Date: '.$img_row['hi_editDT'];

            }else{

                $dt = 'Submit Date: '.$img_row['hi_submitDT'];

            }

            if ($img_pos == 1) {

               // echo '<div align="justify">'.$img_name.'</div><hr>';

                 echo '<div style="position: relative;">

                            <div align="justify">'.$img_name.'</div>

                            <div style="position: absolute;z-index: 999;margin: 0 auto;left: 0;right: 0;top: -6%; text-align: right;width: 90%;">

                                <font color="black"><b>'.$dt.'</b></font>

                            </div>

                        </div><hr>';

            }else{



                 

                 echo '<div style="position: relative;">

                            <img src="'.$img_path.$img_name.'" width="100%" style="display: block;margin-left: auto;margin-right: auto;margin-bottom:7px;">

                            <div style="position: absolute;z-index: 999;margin: 0 auto;left: 0;right: 0;top: 3%; text-align: right;width: 90%;">

                                <font color="black"><b>'.$dt.'</b></font>

                            </div>

                        </div>';

            }



           

        }

 	}



}



 ?>