本文整理汇总了PHP中Database::bind方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::bind方法的具体用法?PHP Database::bind怎么用?PHP Database::bind使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database::bind方法的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: getByMuseum
function getByMuseum($museum_id, $today)
{
global $api_response;
global $api_response_code;
try {
$database = new Database();
$database->query("SELECT * FROM exhibitions_info WHERE end_date >= :today AND museum_id = :museum_id ORDER BY start_date ASC");
$database->bind(':today', $today);
$database->bind(':museum_id', $museum_id);
$rows = array();
$rows = $database->resultset();
$database = null;
if ($rows == null) {
//not found any exhibitions return error
$api_response = $api_response_code[5];
} else {
$api_response = $api_response_code[1];
}
return $rows;
} catch (PDOException $e) {
$database = null;
$api_response = $api_response_code[0];
//die( "Query failed: " . $e->getMessage() );
return null;
}
}
示例3: mainP
public function mainP()
{
$sen = 0;
$db = new Database();
foreach ($this->sentences as $sentence) {
$highest = 0;
$words = array();
$words = explode(" ", $sentence);
foreach ($words as $word) {
if (!in_array(strtolower($word), $this->stopwords)) {
//Fetching the meaning definition of the senses From the WordNet
$db->query("SELECT * from words where lemma like :word");
$db->bind("word", $word);
$wordid = $db->single()->wordid;
$db->query("SELECT * from senses where wordid like :wordid");
$db->bind("wordid", $wordid);
$resulta2 = $db->resultset();
foreach ($resulta2 as $row) {
$synsetid = $row->synsetid;
$sample2[] = $synsetid;
$title = $row->wordid . " " . $row->senseid;
}
$db->query("select * from synsets where synsetid like :sample");
$db->bind("sample", $sample2[0]);
$resulta3 = $db->resultset();
unset($sample2[0]);
for ($i = 0; $i < count($sample2) + 1; $i++) {
${result_A . $i} = $sample2[$i];
${lexdomains_var . $i} = $lexdomains[$i];
$db->query("select * from synsets where synsetid like :sample");
$db->bind("sample", ${result_A . $i});
${result . $i} = $db->resultset();
foreach (${result . $i} as $row) {
${pos . $i} = $row->pos;
if (${pos . $i} == "s") {
${pos . $i} = "satellite adj";
}
$def = $row->definition;
$def = preg_replace('/[^a-zA-Z0-9_ -]/s', '', $def);
$definition = array();
$definition = explode(" ", $def);
$frequency = $this->frequency($definition);
if ($frequency > $highest) {
$highest = $frequency;
}
}
}
$sample2 = array();
}
}
$this->frequencies[] = $highest;
$this->sentence_count[] = $sen;
$sen++;
}
}
示例4: 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>";
}
}
}
示例5: regi
public function regi()
{
$database = new Database();
$database->query("INSERT INTO users VALUES (Null,'" . $this->Login . "', '" . $this->Password . "', '" . $this->Email . "', now(),now(),'unblock')");
$database->bind(':Id', Null);
$database->bind(':Login', $this->Login);
$database->bind(':Password', $this->Password);
$database->bind(':Email', $this->Email);
$database->bind(':blockunblock', 'unblock');
$database->execute();
//$query = "INSERT INTO users VALUES (Null,'".$this->Login."', '".$this->Password."', '".$this->Email."', now(),now(),'unblock')";
return $query;
}
示例6: userPostCount
function userPostCount($user_id)
{
$db = new Database();
$db->query("SELECT * FROM topics \n\t\t\t\t\t WHERE user_id=:user_id");
$db->bind('user_id', $user_id);
$db->resultSet();
$topic_count = $db->rowCount();
$db->query("SELECT * FROM replies\n\t\t\t\t WHERE user_id=:user_id");
$db->bind('user_id', $user_id);
$db->resultSet();
$reply_count = $db->rowCount();
return $topic_count + $reply_count;
}
示例7: userPostCount
function userPostCount($user_id)
{
$db = new Database();
//topic count
$db->query("SELECT * FROM topics\n\t\t\t\tWHERE user_id = :user_id\n\t\t\t\t");
$db->bind(":user_id", $user_id);
$rows = $db->resultset();
$topic_count = $db->rowCount();
//reply count
$db->query("SELECT * FROM replies\n\t\t\t\tWHERE user_id = :user_id\n\t\t\t\t");
$db->bind(":user_id", $user_id);
$rows = $db->resultset();
$reply_count = $db->rowCount();
return $topic_count + $reply_count;
}
示例8: 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;
}
}
示例9: RemoveMatchingProcess
public function RemoveMatchingProcess($param)
{
parent::query('DELETE FROM dy_place_to_tag WHERE (pt_place_id = :place_id AND pt_tag_id = :tag_id)');
parent::bind(':place_id', $param['place_id']);
parent::bind(':tag_id', $param['tag_id']);
parent::execute();
}
示例10: ListDistrictProcess
public function ListDistrictProcess($param)
{
parent::query('SELECT * FROM dy_location_district WHERE ds_city_id = :city_id ORDER BY ds_id ASC');
parent::bind(':city_id', $param['city_id']);
parent::execute();
return parent::resultset();
}
示例11: 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> ';
}
示例12: DeleteItem
public function DeleteItem($id = 0)
{
$db = new Database();
$db->query("DELETE FROM menuitem WHERE `Id`=:id");
$db->bind(':id', $id);
$db->execute();
header("Location: index.php");
}
示例13: EditItemsInOrderProcess
public function EditItemsInOrderProcess($param)
{
parent::query('UPDATE dd_order_detail SET odt_amount = :amount WHERE odt_order_id = :order_id AND odt_product_id = :product_id');
parent::bind(':amount', $param['amount']);
parent::bind(':order_id', $param['order_id']);
parent::bind(':product_id', $param['product_id']);
parent::execute();
}
示例14: DeletePhotoProcess
public function DeletePhotoProcess($param)
{
parent::query('DELETE FROM dy_image WHERE (im_id = :image_id AND im_member_id = :member_id AND im_post_id = :post_id)');
parent::bind(':member_id', $param['member_id']);
parent::bind(':image_id', $param['image_id']);
parent::bind(':post_id', $param['post_id']);
parent::execute();
}
示例15: commentsCount
function commentsCount($post_id)
{
$db = new Database();
$db->query("SELECT * FROM comments WHERE post_id = :post_id");
$db->bind(':post_id', $post_id);
$rows = $db->resultset();
return $db->rowCount();
}