本文整理汇总了PHP中DataBase::fire方法的典型用法代码示例。如果您正苦于以下问题:PHP DataBase::fire方法的具体用法?PHP DataBase::fire怎么用?PHP DataBase::fire使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase::fire方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveToDB
public function saveToDB($poiId, $componentId, $stageRating)
{
global $secKeys;
$now = date("Y-m-d H:i:s");
try {
DataBase::connect('localhost', $secKeys->cakeVars->{'dbUsr'}, $secKeys->cakeVars->{'dbPw'}, $secKeys->cakeVars->{'dbCake'});
$sql = "INSERT INTO stages (component_id, poi_id, created, modified, rating) VALUES (:component_id, :poi_id, :tstamp, :tstamp, :rating)";
$para = array('component_id' => $componentId, 'poi_id' => $poiId, 'tstamp' => $now, 'rating' => $stageRating);
DataBase::fire($sql, $para);
$this->savedStagesCount = DataBase::lastInsertId();
DataBase::close();
} catch (Exception $e) {
die('Fehler bei .... Fehler: ' . $e->getMessage());
}
}
示例2: saveToDB
public function saveToDB($filterdQueryData)
{
global $secKeys;
ControlFunctions::forDebug($filterdQueryData, "Gefilterte Pois");
// for ($i = 0; $i < 5; $i++) {
for ($i = 0; $i < count($filterdQueryData); $i++) {
$now = date("Y-m-d H:i:s");
try {
DataBase::connect('localhost', $secKeys->cakeVars->{'dbUsr'}, $secKeys->cakeVars->{'dbPw'}, $secKeys->cakeVars->{'dbCake'});
$sql = "INSERT INTO pois (created, modified, name, lat, lng, google_place, icon, rating, vicinity) VALUES (:tstamp, :tstamp, :name, :lat, :lng, :google_place, :icon, :rating, :vicinity)";
$para = array('tstamp' => $now, 'name' => $filterdQueryData[$i]->name, 'lat' => $filterdQueryData[$i]->geometry->location->lat, 'lng' => $filterdQueryData[$i]->geometry->location->lng, 'google_place' => $filterdQueryData[$i]->place_id, 'icon' => $filterdQueryData[$i]->icon, 'rating' => isset($filterdQueryData[$i]->rating) ? $filterdQueryData[$i]->rating : null, 'vicinity' => $filterdQueryData[$i]->vicinity);
DataBase::fire($sql, $para);
$lastPoisId = DataBase::lastInsertId();
echo ControlFunctions::tagIt("h1", "Letzter Eintrag: " . $lastPoisId);
foreach ($filterdQueryData[$i]->types as $tag) {
$tagId = null;
// Check if tag is already present
$sql = "SELECT EXISTS(SELECT 1 FROM tags WHERE title LIKE '%" . $tag . "%')";
$rows = DataBase::fire($sql);
$tagPresent = current(current($rows)) == "1" ? true : false;
ControlFunctions::forDebug($rows, "Ausgabe für Tag {$tag}");
echo $tagPresent ? "Wert für {$tag} ist: vorhanden" : "Wert für {$tag} ist: Nicht existent!";
if ($tagPresent) {
$sql = "SELECT id FROM tags WHERE title LIKE '%" . $tag . "%'";
$rows = DataBase::fire($sql);
$tagId = current(current($rows));
ControlFunctions::forDebug($rows, "Ausgabe für Tag {$tag}, tag ID: ");
echo ControlFunctions::tagIt("h1", "{$tag} ID: {$tagId}");
} else {
// Paste Tag
$sql = "INSERT INTO tags (title, created, modified) VALUES (:title, :tstamp, :tstamp)";
$para = array('title' => $tag, 'tstamp' => $now);
DataBase::fire($sql, $para);
// Save ID
$tagId = DataBase::lastInsertId();
}
// Paste Relation
$sql = "INSERT INTO pois_tags (poi_id, tag_id) VALUES (:poi_id, :tag_id)";
$para = array('poi_id' => $lastPoisId, 'tag_id' => $tagId);
DataBase::fire($sql, $para);
echo ControlFunctions::tagIt("h1", "Letzter Eintrag: " . DataBase::lastInsertId());
}
DataBase::close();
} catch (Exception $e) {
die('Fehler bei .... Fehler: ' . $e->getMessage());
}
}
}