本文整理汇总了PHP中Database::single方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::single方法的具体用法?PHP Database::single怎么用?PHP Database::single使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database::single方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ZoekTijd
public function ZoekTijd()
{
require_once "/Classes/databaseHandler.class.php";
$Database = new Database();
require_once "/Classes/calculatetime.php";
$calculatetime = new calculatetime();
$Database->query('SELECT fileName, name FROM wedstrijden WHERE name=?');
$Database->bind(1, $_GET['wedstrijd']);
$resultSet = $Database->single();
if (isset($_GET['startnummer']) || isset($_GET['naam'])) {
include 'Classes/PHPExcel/IOFactory.php';
$inputFileName = 'excel/' . $resultSet['fileName'];
try {
$inputFileType = PHPExcel_IOFactory::identify($inputFileName);
$objReader = PHPExcel_IOFactory::createReader($inputFileType);
$objPHPExcel = $objReader->load($inputFileName);
} catch (Exception $e) {
die('Er is een fout opgetreden met bestand "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
}
$sheet = $objPHPExcel->getSheet(0);
$highestRow = $sheet->getHighestRow();
$highestColumn = $sheet->getHighestColumn();
for ($row = 1; $row <= $highestRow; $row++) {
$rowData[] = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE)[0];
}
if (isset($_GET['startnummer']) && $_GET['startnummer'] == !null) {
$Startnummer = $_GET['startnummer'];
$key = array_search($Startnummer, array_column($rowData, 0));
}
if (isset($_GET['naam']) && $_GET['naam'] == !null) {
$Naam = $_GET['naam'];
$key = array_search($Naam, array_column($rowData, 1));
}
$this->Startnummer = $rowData[$key][0];
$this->Naam = $rowData[$key][1];
$this->Woonplaats = $rowData[$key][2];
$this->Geboortedatum = $rowData[$key][3];
$this->Geslacht = $rowData[$key][4];
$this->Wedstrijdnaam = $resultSet['name'];
$cell = $sheet->getCellByColumnAndRow(5, $key + 1);
$cell_value = PHPExcel_Style_NumberFormat::toFormattedString($cell->getCalculatedValue(), 'hh:mm:ss');
$this->VideoTijd = $calculatetime->GetPlayerTime($cell_value);
$_GET['startnummer'] = $this->Startnummer;
}
}
示例2: ZoekTijd
public function ZoekTijd()
{
require_once "/Classes/databaseHandler.class.php";
$Database = new Database();
require_once "/Classes/calculatetime.php";
$calculatetime = new calculatetime();
$Database->query('SELECT wedstrijdID, name FROM wedstrijden WHERE wedstrijdID=?');
$Database->bind(1, $_GET['eventid']);
$wedstrijden = $Database->single();
$Database->query('SELECT camName, videoID FROM cams WHERE fk_wedstrijdID=?');
$Database->bind(1, $_GET['eventid']);
$cams = $Database->single();
$Database->query('SELECT * FROM tijden WHERE fk_wedstrijdID=? AND Startnummer=?');
$Database->bind(1, $_GET['eventid']);
$Database->bind(2, $_GET['startnummer']);
$tijd = $Database->single();
if (isset($_GET['video'])) {
$Database->query('SELECT camName, videoID, tijdName FROM cams WHERE camID=?');
$Database->bind(1, $_GET['video']);
$cams = $Database->single();
$Database->query('SELECT * FROM tijden WHERE fk_wedstrijdID=? AND Startnummer=?');
$Database->bind(1, $_GET['eventid']);
$Database->bind(2, $_GET['startnummer']);
$tijd = $Database->single();
if (empty($tijd)) {
header("Location: ?error&code=1");
die;
}
$this->Startnummer = $tijd['Startnummer'];
$this->Naam = $tijd['Naam'];
$this->Woonplaats = $tijd['Woonplaats'];
$this->Geboortedatum = $tijd['Geboortedatum'];
$this->Geslacht = $tijd['Geslacht'];
$this->Wedstrijdnaam = $wedstrijden['name'];
$this->VideoID = $cams['videoID'];
$this->CamName = $cams['camName'];
$this->VideoTijd = $calculatetime->GetPlayerTime($tijd[$cams['tijdName']]);
$this->RenderPage();
} else {
if (empty($tijd)) {
header("Location: ?error&code=1");
die;
}
$this->Startnummer = $tijd['Startnummer'];
$this->Naam = $tijd['Naam'];
$this->Woonplaats = $tijd['Woonplaats'];
$this->Geboortedatum = $tijd['Geboortedatum'];
$this->Geslacht = $tijd['Geslacht'];
$this->Wedstrijdnaam = $wedstrijden['name'];
$this->VideoID = $cams['videoID'];
$this->CamName = $cams['camName'];
$this->VideoTijd = $calculatetime->GetPlayerTime($tijd['Finish']);
$this->RenderPage();
}
//7-11-2015 wijzigen van Excel naar database.
}
示例3: renderSearch
public function renderSearch()
{
require_once "/Classes/databaseHandler.class.php";
$Database = new Database();
$Database->query('SELECT fileName, name, date FROM wedstrijden');
$resultSet = $Database->single();
print '
</div >
<div id = "clickTable" class="container" >
<table id = "myTable" class="table" >
<thead>
<tr>
<th> Startnr <i class="fa fa-sort" ></i></th>
<th> Wedstrijd <i class="fa fa-sort" ></i></th>
<th> Naam <i class="fa fa-sort" ></i></th>
<th> Woonplaats <i class="fa fa-sort" ></i></th>
<th> Geboortedatum <i class="fa fa-sort" ></i></th>
<th> Geslacht</th >
<th> Netto tijd <i class="fa fa-sort" ></i></th>
<th> Onderdeel <i class="fa fa-sort" ></i> </th>
<th> Beeld</th>
</tr></thead ><tbody> ';
$Database->query('SELECT * FROM tijden WHERE Naam LIKE ?');
if (!isset($_GET['show'])) {
$Database->bind(1, "%" . $_POST['naam'] . "%");
$result = $Database->resultset();
if (empty($result)) {
echo "Deelnemer niet gevonden.";
}
foreach ($result as $data) {
$Database->query('SELECT fileName, name, date FROM wedstrijden WHERE wedstrijdID=?');
$Database->bind(1, $data['fk_wedstrijdID']);
$resultSet = $Database->single();
print ' <tr><td> ' . $data['Startnummer'] . ' </td> ';
print '<td> ' . $resultSet['name'] . ' </td> ';
print '<td> ' . $data['Naam'] . ' </td> ';
print '<td> ' . $data['Woonplaats'] . ' </td> ';
print '<td> ' . $data['Geboortedatum'] . ' </td> ';
echo "<td>";
if ($data['Geslacht'] == "V") {
echo ' <i class="fa fa-female" ></i> ';
} else {
echo '<i class="fa fa-male" ></i> ';
}
echo "</td>";
print '<td> ' . $data['NettoTijd'] . ' </td> ';
print '<td> ' . $data['Onderdeel'] . ' </td> ';
print "<td><a class='fa fa-line-chart' href='?statistieken&startnummer=" . $data['Startnummer'] . "&eventid=" . $data['fk_wedstrijdID'] . "'></a>";
print " <a class='fa fa-video-camera' href='?newplayer&wedstrijd=" . $resultSet['name'] . "&naam=& startnummer=" . $data['Startnummer'] . "'></a>";
print " <a class='fa fa-camera' </a> ";
print " <a class='fa fa-certificate' target='_blank' href='https://uitslagensoftware.nl/certificaat_3.php?event_id=2015083000294&S= " . $data['Startnummer'] . "'></a></td></tr>";
}
}
}
示例4: login
/**
* User Login
*
* @param $username
* @param $password
* @return bool
*/
public function login($username, $password)
{
$this->db->query("SELECT * FROM users\n\t\t\t\tWHERE username = :username\n\t\t\t\tAND password = :password");
//Bind Values
$this->db->bind(':username', $username);
$this->db->bind(':password', $password);
$row = $this->db->single();
//Check Rows
if ($this->db->rowCount() > 0) {
$this->setUserData($row);
return true;
} else {
return false;
}
}
示例5: fetchAllBySeccionId
public function fetchAllBySeccionId($seccionId)
{
$dbh = new Database();
$data = $dbh->query('SELECT * FROM subsecciones WHERE seccion_id =' . $seccionId);
$data = $dbh->single();
return $data;
}
示例6: CountPhotoOfPlaceProcess
public function CountPhotoOfPlaceProcess($param)
{
parent::query('SELECT COUNT(im_id) total FROM dy_image WHERE (im_place_id = :place_id) AND (im_type = "normal")');
parent::bind(':place_id', $param['place_id']);
parent::execute();
return parent::single();
}
示例7: SearchLogCountProcess
public function SearchLogCountProcess()
{
parent::query('SELECT COUNT(lo_id) FROM log_search');
parent::execute();
$data = parent::single();
return $data['COUNT(lo_id)'];
}
示例8: fetchOneById
public function fetchOneById($tiendaId)
{
$dbh = new Database();
$data = $dbh->query('SELECT * FROM tiendas WHERE tienda_id =' . $tiendaId);
$data = $dbh->single();
return $data;
}
示例9: GetCityProcess
public function GetCityProcess($param)
{
parent::query('SELECT * FROM dy_location_city WHERE (cy_id = :city_id)');
parent::bind(':city_id', $param['city_id']);
parent::execute();
return parent::single();
}
示例10: RenderPage
public function RenderPage()
{
require_once "/Classes/databaseHandler.class.php";
$Database = new Database();
print '
<title>Run2Day - Bannerbeheer</title>
<h1>Bannerbeheer</h1>
<table class="table">
<tr>
<th>Toegevoegd aan</th>
<th>Bestandsnaam</th>
<th>Banner tekst</th>
<th>Verwijderen</th>
</tr> ';
$Database->query('SELECT ID, fileName, fk_wedstrijdID, text FROM afbeeldingen');
$result = $Database->resultset();
foreach ($result as $key) {
$Database->query('SELECT name FROM wedstrijden WHERE wedstrijdID=?');
$Database->bind(1, $key['fk_wedstrijdID']);
$wedstrijd = $Database->single();
print '<tr><td>' . $wedstrijd['name'] . ' </td>';
print '<td>' . $key['fileName'] . ' </td>';
print '<td>' . $key['text'] . ' </td>';
print ' <td><a class="fa fa-trash-o" href="?dashboard&deletebanner=' . $key['ID'] . '"</td></tr>';
}
print '
</table>
<div class="col-md-4">
<h3>Banner afbeelding toevoegen</h3>
<form action="../Classes/submitWedstrijd.php" method="POST" enctype="multipart/form-data">
<label for="usr">Banner toevoegen aan:</label>
<select class="form-control" name="wedstrijd" id="wedstrijd">';
$Database->query('SELECT name, wedstrijdID FROM wedstrijden');
$result = $Database->resultset();
foreach ($result as $key) {
print ' <option> ' . $key['name'] . '</option>';
}
print '
</select>
<div class="form-group">
<label for="usr">Banner tekst:</label>
<input type="text" class="form-control" id="name" name="name" required>
</div>
<div class="form-group">
<label for="usr">Afbeelding:</label>
<input type="file" name="file" id="file">
</div>
<input type="submit" value="Opslaan">
<br><br>
</form>
</div>
</div>
</div> ';
}
示例11: CommentAlreadyCheckingProcess
public function CommentAlreadyCheckingProcess($param)
{
parent::query('SELECT ac_id FROM dy_activity WHERE (ac_member_id = :member_id) AND (ac_action = "new_comment") AND (ac_to_post_id = :post_id)');
parent::bind(':member_id', $param['member_id']);
parent::bind(':post_id', $param['post_id']);
parent::execute();
return parent::single();
}
示例12: getItem
public function getItem($id = 0)
{
$db = new Database();
$db->query("SELECT * FROM menuitem WHERE Id=:id");
$db->bind(":id", $id);
$db->execute();
return $db->single();
}
示例13: getCategory
/**
* Get Category By ID
*
* @param int $id
* @return mixed
*/
public function getCategory($id)
{
$this->db->query("SELECT * FROM categories\n\t\t\tWHERE id = :id");
$this->db->bind(':id', $id);
//Assign Row
$row = $this->db->single();
return $row;
}
示例14: checkUsersGroups
/**
* Check that any of the users' groups has the permission bit
*
* @param string $action
* @param int|null $context_id
* @param int|null $user_id
* @param bool $ignore_superuser
* @return bool
*/
public function checkUsersGroups(string $action = '', int $context_id = null, int $user_id = null, bool $ignore_superuser = false) : bool
{
if (!$ignore_superuser) {
if ($this->isSuperUser($user_id)) {
return true;
}
}
return 0 < $this->db->single(\Airship\queryStringRoot('security.permissions.check_users_groups', $this->db->getDriver()), ['action' => $action, 'context' => $context_id, 'user' => $user_id]);
}
示例15: GetCategoryProcess
public function GetCategoryProcess($param)
{
parent::query('SELECT ca_id,ca_title,ca_root,ca_parent_first,ca_parent_second,ca_create_time,ca_update_time,ca_type,ca_status,(SELECT COUNT(pl_id) FROM dy_place WHERE pl_category_id = ca_id) total_place
FROM dy_category
WHERE ca_id = :category_id');
parent::bind(':category_id', $param['category_id']);
parent::execute();
return parent::single();
}