if(isset($_GET['groupname'], $_GET['decks'], $_GET['rows']))
{
$groupname = $_GET['groupname'];
$decks = $_GET['decks'];
$rows = $_GET['rows'];
$pickdeckrows = $rows/$decks;
// for($i=1; $i<=$decks; $i++){
$stmt = $dbcoect->prepare("SELECT v.decknumber, v.vtext FROM decks v WHERE v.groupname =:groupname LIMIT :pickdeckrows");
$stmt -> bindValue(':groupname', $groupname);
$stmt -> bindValue(':pickdeckrows', $pickdeckrows);
$stmt -> execute();
ob_end_clean();
$output = '
<table class="table" bordered="1">
<tr>
<th>GroupId</th>
<th>Text</th>
</tr>
';
while($row = $stmt -> fetch())
{
$output .= '
<tr>
<td>'.$row["decknumber"].'</td>
<td>'.$row["vtext"].'</td>
</tr>
';
}
$output .= '</table>';
header('Content-Type: application/vnd.ms-excel');
header('Content-Disposition: attachment; filename='.$groupname.'deck.xls');
echo $output;
$stmtdelete = $dbcoect->prepare("DELETE FROM decks WHERE groupname =:groupname LIMIT :pickdeckrows");
$stmtdelete -> bindValue(':groupname', $groupname);
$stmtdelete -> bindValue(':pickdeckrows', $pickdeckrows);
$stmtdelete -> execute();
// }
}
برچسب:
نویسنده: آیلین رضوانی