first of all i am new in this programming area so i don't know how to do this?
have a database table "video_master" in that i have "ID, REC_ID, VIDEO_DATE, VIDEO_COUNT, IS_REDIM, field in it. now i want a count of that amount. i use if and get a amount as video but now i don't know how to take a that amount sum. total amount. here i give what i done.
<?php
// If user not logged in then show login message
if (!isset($_SESSION['userid'])) {
?><div class="message">
To access this page, you must be logged.<br />
<a href="connexion.php">Log in</a>
</div><?php
}
else{
//Video count values of the database
if(isset($_REQUEST['date1']) && isset($_REQUEST['date2'])){
$dnn = mysqli_query($conn, 'select video_date,video_count from video_master where rec_id="'.$_SESSION['userid'].'" and video_date >= "' . $_REQUEST['date1'] . '" and video_date <= "' . $_REQUEST['date2'] . '"');
}
else{
$dnn = mysqli_query($conn, 'select id,video_date,video_count,is_redim from video_master where rec_id="'.$_SESSION['userid'].'"');
}
if(mysqli_num_rows($dnn)>0)
{
?><table>
<thead>
<tr>
<th>ID</th>
<th>Date</th>
<th>Video Count</th>
<th>Total Amount</th>
<th>Is Redim ?</th>
</tr></thead><?php
while($rowData = mysqli_fetch_array($dnn)){
//$video_date = date("Y-m-d","d-m-Y",$rowData['video_date']);
$video_date = $rowData['video_date'];
$video_count = $rowData['video_count'];
?><tbody><tr>
<td><?php echo $rowData['id']; ?></td>
<td><?php print($video_date); ?></td>
<td><?php print($video_count); ?></td>
<td><?php //echo $rowData['video_count'];
if($rowData['video_count'] < 250){
$amount1 = $rowData['video_count']*0;
echo $amount1;
}
else{
if($rowData['video_count'] <= 500){
$amount1 = $rowData['video_count']*0.25;
echo $amount1;
} else
{
if($rowData['video_count'] <= 750){
$amount1 = $rowData['video_count']*0.50;
echo $amount1;
} else
{
if($rowData['video_count'] <= 1000){
$amount1 = $rowData['video_count']*0.75;
echo $amount1;
} else
{
if($rowData['video_count'] <= 1250){
$amount1 = $rowData['video_count']*1;
echo $amount1;
} else
{
if($rowData['video_count'] < 1500){
$amount1 = $rowData['video_count']*1.50;
echo $amount1;
} else
{
}
}
}
}
}
}
?></td>
<td><?php echo $rowData['is_redim']; ?></td>
</tr></tbody><?php
}
?></table><?php
}
?>
<?php
}
?>
i get a "$amount" as a video but now i want to calculate the total of that $amount. amount field is not in the database. i get the amount from video_count.
Aucun commentaire:
Enregistrer un commentaire