本文整理汇总了PHP中CQuery::query方法的典型用法代码示例。如果您正苦于以下问题:PHP CQuery::query方法的具体用法?PHP CQuery::query怎么用?PHP CQuery::query使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CQuery
的用法示例。
在下文中一共展示了CQuery::query方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFields
/**
* @return CArrayList
*/
public function getFields()
{
if (is_null(self::$_fields)) {
self::$_fields = new CArrayList();
}
if (!self::$_fields->hasElement($this->name)) {
$fields = new CArrayList();
$query = new CQuery();
$query->query("DESCRIBE " . $this->name);
foreach ($query->execute()->getItems() as $field) {
$fields->add($field["Field"], new CDbTableField($field));
}
self::$_fields->add($this->name, $fields);
}
return self::$_fields->getItem($this->name);
}
示例2: showVisitorsList
function showVisitorsList()
{
$cq = new CQuery();
$sql_result = $cq->query("SELECT * FROM `" . $this->sqlSettings['tableVisitorsList'] . "`");
echo <<<HTML
\t\t\t\t<table>
\t\t\t\t\t<tr>
\t\t\t\t\t\t<td class="header">Id</td>
\t\t\t\t\t\t<td class="header">Ip Address</td>
\t\t\t\t\t\t<td class="header">Country</td>
\t\t\t\t\t\t<td class="header">Exploited</td>
\t\t\t\t\t</tr>
HTML;
while ($row = $cq->fetchassoc($sql_result)) {
$sql_result2 = $cq->query("SELECT * FROM `" . $this->sqlSettings['dbVisitorsExploits'] . "` WHERE visitor_id ='" . mysql_real_escape_string($row['id']) . "'");
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['ipAddress'] . "</td>";
echo "<td>";
echo $row['country'] . "</td>";
echo "<td>";
if ($row['exploited']) {
echo "YES";
} else {
echo "NO";
}
echo "</td>";
echo "</tr>";
}
echo "</table>";
}
示例3: commit
/**
* Фиксация транзакции
*/
public function commit()
{
$query = new CQuery();
$query->query("COMMIT;")->execute();
}