%PDF- %PDF-
Direktori : /www/varak.net/practiscore.varak.net_old/practiscore.varak.net/app/ |
Current File : //www/varak.net/practiscore.varak.net_old/practiscore.varak.net/app/csv.php |
<?php /** * Created by IntelliJ IDEA. * User: mvarak * Date: 5/16/2018 * Time: 8:53 AM */ header("Content-Type: text/csv"); header("Content-Disposition: attachment; filename=\"shooters-$id-" . time() . ".csv\""); //print_r($_POST); $result = dibi::query("SELECT [firstName], [lastName], [email], [region], [factor], [division], [category], [squad] FROM [shooters] WHERE [match]=%i AND [squad] IN (%i) AND [registered]=1 ORDER BY [order]", $_POST['match'], $_POST['squads']); echo "Member,First Name,Last Name,Email,Region,Division,Age,Gender,Power Factor,Squad\n"; foreach($result as $res) { $line = ","; $line .= $res->firstName . ","; $line .= $res->lastName . ","; $line .= $res->email . ","; $line .= $res->region . ","; $line .= $res->division . ","; $line .= (($res->category != 'REGULAR' && $res->category != 'LADY') ? $res->category : "") . ","; $line .= (($res->category == 'LADY') ? $res->category : "") . ","; $line .= $res->factor . ","; $line .= $res->squad . "\n"; echo $line; } die;