本文整理汇总了PHP中mysql_class::directQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql_class::directQuery方法的具体用法?PHP mysql_class::directQuery怎么用?PHP mysql_class::directQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql_class
的用法示例。
在下文中一共展示了mysql_class::directQuery方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add
public function add($tableName, $data, $query)
{
if ($tableName != '') {
$createTime = date("Y-m-d H:i:s");
$mysql = new mysql_class();
$thisId = -1;
$mysql->enableCache = FALSE;
$mysql->directQuery("select `id` from `cache` where `tableName` = '{$tableName}' and `query` = '{$query}' ", $q);
if ($r = $mysql->fetch_array($q)) {
$thisId = $r['id'];
}
if ($thisId > 0) {
$mysql->directQueryx("update `cache` set `data` = '" . serialize($data) . "' where `id` = '{$thisId}'");
} else {
$ln = $mysql->ex_sqlx("insert into `cache` (`tableName`,`data`,`createTime`,`query`) values('{$tableName}','" . serialize($data) . "','{$createTime}','{$query}') ", FALSE);
$thisId = (int) $mysql->insert_id($ln);
$mysql->close($ln);
}
$this->id = $thisId;
$this->tableName = $tableName;
$this->data = $data;
$this->query = $query;
$this->createTime = $createTime;
$this->viewCount = 1;
}
return $this->id;
}
示例2: __construct
public function __construct($inp = array())
{
$mysql = new mysql_class();
$css = 'ajaxgrid_mainDiv';
$tableProperty = "class='ajaxgrid_mainTable'";
if (count($inp) != 0 && is_array($inp)) {
$gtmp = array();
foreach ($inp as $gname => $det) {
$gtmp[$gname]['gname'] = $gname;
$gtmp[$gname]['table'] = $det['table'];
$gtmp[$gname]['contentDiv'] = $det['div'];
$this->contentDiv[$gname] = $det['div'];
$gtmp[$gname]['canAdd'] = FALSE;
$this->canAdd[$gname] = FALSE;
$gtmp[$gname]['canEdit'] = FALSE;
$this->canEdit[$gname] = FALSE;
$gtmp[$gname]['canDelete'] = FALSE;
$this->canDelete[$gname] = FALSE;
$gtmp[$gname]['targetFile'] = $this->getAddr();
$this->targetFile[$gname] = $gtmp[$gname]['targetFile'];
$gtmp[$gname]['cssClass'] = 'ajaxgrid';
$this->cssClass[$gname] = 'ajaxgrid';
$gtmp[$gname]['start'] = TRUE;
$this->start[$gname] = TRUE;
$gtmp[$gname]['xls'] = FALSE;
$this->xls[$gname] = TRUE;
$gtmp[$gname]['addColCount'] = 3;
$this->addColCount[$gname] = 3;
$gtmp[$gname]['tableProperty'] = "class='ajaxgrid_mainTable'";
$this->tableProperty[$gname] = "class='ajaxgrid_mainTable'";
$gtmp[$gname]['css'] = "darkDiv";
$gtmp[$gname]['eRequest'] = array();
$gtmp[$gname]['pageNumber'] = 1;
$gtmp[$gname]['query'] = isset($det['query']) ? $det['query'] : '';
$this->query[$gname] = $gtmp[$gname]['query'];
$this->tables[$gname] = $det['table'];
$this->pageRows[$gname] = 10;
$this->whereClause[$gname] = '';
$this->pageNumber[$gname] = 1;
$this->eRequest[$gname] = array();
$this->scrollDown[$gname] = FALSE;
$this->afterCreateFunction[$gname] = '';
$this->disableRowColor[$gname] = FALSE;
$this->buttonTitles[$gname] = array('delete' => 'حذف', 'add' => 'ثبت', 'next' => 'بعد', 'pre' => 'قبل');
$q = null;
$mysql->enableCache = FALSE;
$mysql->oldSql = TRUE;
$qur = isset($this->query[$gname]) && trim($this->query[$gname]) != '' ? $this->query[$gname] : 'select * from `' . $this->tables[$gname] . '` where 1=0 ';
$mysql->directQuery($qur, $q);
if (isset($this->query[$gname]) && trim($this->query[$gname]) != '') {
$this->qq[$gname] = $q;
}
while ($r = $mysql->fetch_field($q)) {
$cTmp['name'] = $r->name;
$cTmp['fieldname'] = $r->name;
$cTmp['css'] = '';
$cTmp['typ'] = $r->type;
$this->column[$gname][] = $cTmp;
}
$this->pageAllRows[$gname] = $this->getTableRowCount($det['table'], $_REQUEST);
$this->pageCount[$gname] = xgrid::getPageCount($this->tables[$gname], $this->pageRows[$gname], $_REQUEST);
$gtmp[$gname]['pageCount'] = $this->pageCount[$gname];
$this->css[$gname] = $gtmp[$gname]['cssClass'];
$this->tableProperty[$gname] = $gtmp[$gname]['tableProperty'];
$this->addFunction[$gname] = null;
$this->editFunction[$gname] = null;
$this->deleteFunction[$gname] = null;
}
$this->arg = json_encode($gtmp);
//toJSON($gtmp);
}
}