Mini Shell

Direktori : /home/rizant5/public_html/development/
Upload File :
Current File : /home/rizant5/public_html/development/sample-data.php

<?php require_once('config.php');

 $data=$conn->prepare("select * from samples a left join courses b on a.course_id=b.course_id group by a.course_id");

   $data->execute();$datares=$data->fetchall();
?>
<script type="text/javascript">
    $('.star').mouseover(function(){
        $(this).parent().addClass('starr');
        $(this).parent().prevAll().addClass('starr');
    });
    $('.star').mouseout(function(){
        $(this).parent().removeClass('starr');
        $(this).parent().prevAll().removeClass('starr');
    });
</script>
<?php

   foreach($datares as $row){?>

	<section>

    	 <div class="container">

             <div class="row">

             <div class="col-sm-12"><h4><?php echo $row['course_name']?></h4></div>

             <?php $db=$conn->prepare("select * from samples where course_id='$row[course_id]'");

			 $db->execute();$dbres=$db->fetchall();

			 foreach($dbres as $rows){

				 $dbs=$conn->prepare("select count(rat_id) as rat_id,sum(rating) as rating from rating where sample_id='$rows[sample_id]'");

			 $dbs->execute();$rowdd=$dbs->fetch();

			 $tot_rating=$rowdd['rating'];

			 $tot_user=$rowdd['rat_id'];

			 if($tot_user==0){$avg=0;}else{$avg=$tot_rating/$tot_user;}

				 ?>

                <div class="col-sm-3 col-xs-12">

                	<div class="samples">

                        <div class="col-sm-12 no-padd">

                               <?php echo $rows['video_url'];?>

                        </div>

                        <div class="sample-text">

                        <h5><?php echo $rows['title'];?></h5>

                            <div class="scroller"><p><?php echo nl2br($rows['sample_desc']);?></p><hr/>End of content.</div>

                            <p align="right" class="default_rate_container">

                            <a href='#' data-toggle="modal" data-target="#myModal" onClick="rating('1','<?php echo $rows['sample_id'];?>')"><i class="fa <?php if(($avg>0)&&($avg<0.9)){echo"fa-star-half-o";}elseif($avg>=1){echo"fa-star";}else{echo "fa-star-o";}?> star"></i></a>&nbsp;

                            <a href='#' data-toggle="modal" data-target="#myModal" onClick="rating('2','<?php echo $rows['sample_id'];?>')"><i class="fa <?php if(($avg>1)&&($avg<1.9)){echo"fa-star-half-o";}elseif($avg>=2){echo"fa-star";}else{echo "fa-star-o";}?> star"></i></a>&nbsp;

                            <a href='#' data-toggle="modal" data-target="#myModal" onClick="rating('3','<?php echo $rows['sample_id'];?>')"><i class="fa <?php if(($avg>2)&&($avg<2.9)){echo"fa-star-half-o";}elseif($avg>=3){echo"fa-star";}else{echo "fa-star-o";}?> star"></i>&nbsp;

                            <a href='#' data-toggle="modal" data-target="#myModal" onClick="rating('4','<?php echo $rows['sample_id'];?>')"><i class="fa <?php if(($avg>3)&&($avg<3.9)){echo"fa-star-half-o";}elseif($avg>=4){echo"fa-star";}else{echo "fa-star-o";}?> star"></i></a>&nbsp;

                            <a href='#' data-toggle="modal" data-target="#myModal" onClick="rating('5','<?php echo $rows['sample_id'];?>')"><i class="fa <?php if(($avg>4)&&($avg<4.9)){echo"fa-star-half-o";}elseif($avg>=5){echo"fa-star";}else{echo "fa-star-o";}?> star"></i></a></p>

                        </div>

                    </div>    

            </div><?php }?>

           </div>

        </div>

    </section>

    

    <?php

   }?>

Zerion Mini Shell 1.0