本文整理汇总了PHP中mysql::getTableName方法的典型用法代码示例。如果您正苦于以下问题:PHP mysql::getTableName方法的具体用法?PHP mysql::getTableName怎么用?PHP mysql::getTableName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysql
的用法示例。
在下文中一共展示了mysql::getTableName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
function run()
{
global $_out;
$mysql = new mysql();
$row = filter_var(param('row'), FILTER_VALIDATE_INT);
if (($rs = $mysql->query('select * from `' . $mysql->getTableName($this->table) . '` where ' . '`section`="' . $this->getSection()->getId() . '" and `module`="' . $this->getConf('module', true) . '" and `id_article`=' . ($row ? $row : 0))) && ($r = $mysql->fetch($rs))) {
if ($v = $r['title']) {
$_out->setMeta('title', $v);
}
if ($v = $r['keywords']) {
$_out->setMeta('keywords', $v);
}
if ($v = $r['description']) {
$_out->setMeta('description', $v);
}
if (($v = $r['h1']) && ($e = $_out->query('/page/section')->item(0))) {
$e->setAttribute('h1', $v);
}
}
}
示例2: uninstall
function uninstall()
{
$mysql = new mysql();
if ($md = $this->getConf('module')) {
$mysql->query('delete from `' . $mysql->getTableName($this->table) . '` where `section`="' . $this->getSection()->getID() . '" AND `module`="' . $md . '"');
}
if ($sec = ap::getClientSection($this->getSection()->getId())) {
$modules = $sec->getModules();
if ($modules->remove($this->getId())) {
$modules->getXML()->save();
}
return true;
}
}
示例3: uninstall
function uninstall()
{
$mysql = new mysql();
$table = $this->table;
if ($rs = $mysql->query('select * from `' . $mysql->getTableName($table) . '` where `section`="' . $this->getSection()->getID() . '" AND `module`="' . $this->getId() . '"')) {
while ($r = mysql_fetch_array($rs)) {
$this->deleteRow($r['id']);
}
}
if ($sec = ap::getClientSection($this->getSection()->getId())) {
$modules = $sec->getModules();
if ($modules->remove($this->getId())) {
$modules->getXML()->save();
}
return true;
}
}
示例4: getNextSortIndex
function getNextSortIndex($form)
{
$mysql = new mysql();
$index = 1;
$rs = $mysql->query('select max(`sort`)+1 as `new_sort_index`
from `' . $mysql->getTableName($form->getAttribute('dbTable')) . '`
where `section`="' . $this->getName() . '" AND `module`="' . $this->getId() . '"');
if ($rs && ($row = mysql_fetch_assoc($rs)) && $row['new_sort_index']) {
$index = $row['new_sort_index'];
}
return $index;
}
示例5: getImages
/**
* Картинки
*/
static function getImages($id, $preview = false, $limit = null)
{
global $_out;
if (!is_array($id)) {
$id = array($id);
}
if (!count($id)) {
return;
}
$res = array();
$mysql = new mysql();
$counter = array();
if ($rs = $mysql->query('SELECT img.*,art.section,art.module
FROM `' . $mysql->getTableName('articles_images') . '` AS img
LEFT JOIN `' . $mysql->getTableName('articles') . '` AS art ON art.id=img.id_article
WHERE `id_article` IN (' . implode(',', $id) . ') AND img.`active`=1
ORDER BY `id_article`,`sort`')) {
while ($r = mysql_fetch_assoc($rs)) {
if ($limit > 0) {
if (!isset($counter[$r['id_article']])) {
$counter[$r['id_article']] = 0;
}
if ($counter[$r['id_article']] >= $limit) {
continue;
}
$counter[$r['id_article']]++;
}
$v = array();
if (is_file($path = 'userfiles/articles/' . $r['section'] . '/' . $r['id'] . '.jpg')) {
list($width, $height) = getimagesize($path);
$v['img'] = $_out->createElement('img', array('id' => $r['id'], 'src' => $path, 'width' => $width, 'height' => $height));
if ($r['title']) {
$v['img']->setAttribute('alt', $r['title']);
}
}
if ($preview && is_file($path = 'userfiles/articles/' . $r['section'] . '/' . $r['id'] . ($preview ? '_preview' : null) . '.jpg')) {
list($width, $height) = getimagesize($path);
$v['prv'] = $_out->createElement('preview', array('src' => $path, 'width' => $width, 'height' => $height));
if ($r['title']) {
$v['prv']->setAttribute('alt', $r['title']);
}
}
if (count($v)) {
$res[$r['id_article']][] = $v;
}
}
}
return $res;
}
示例6: fixedFields
function fixedFields($form)
{
global $_sec;
$clientSection = ap::getClientSection($_sec->getId());
$md = $clientSection->getXML()->getElementById($this->getId());
if ($clientSection->getXML()->evaluate('string(./form[1]/@dbSave)', $md) && ($dbConnect = $clientSection->getXML()->evaluate('string(./form[1]/@dbConnect)', $md)) && ($dbTable = $clientSection->getXML()->evaluate('string(./form[1]/@dbTable)', $md)) && ($ff = $form->appendField(formSelect::create('uri', 'Database field name:', '/@uri')))) {
$ff->addOption('', '...');
$mysql = new mysql($dbConnect);
$q = 'SHOW COLUMNS FROM ' . $mysql->getTableName($dbTable);
$rs = $mysql->query($q);
while ($res = mysql_fetch_assoc($rs)) {
if (!$res['Extra']) {
$ff->addOption($res['Field'], $res['Field']);
}
}
}
}
示例7: getTableName
function getTableName()
{
$params = mysqllist::getParams($this->params);
$mysql = new mysql($params['con']);
return $mysql->getTableName($params['table']);
}
示例8: getRow
function getRow($con, $table, $cond)
{
if (isset($cache[$con][$table][$cond])) {
return $cache[$con][$table][$cond];
}
if ($table && $cond) {
$mysql = new mysql($con);
$query = 'SELECT * FROM `' . $mysql->getTableName($table) . '` WHERE ' . $cond;
if ($rs = $mysql->query($query)) {
return $cache[$con][$table][$cond] = mysql_fetch_assoc($rs);
}
}
}
示例9: load
private function load($id_article)
{
$mysql = new mysql();
$values = $this->getSubmitImages();
$isUpdate = is_array($values);
$arId = $isUpdate ? array_keys($values['exist']) : array();
if (($rs = $mysql->query('select `id`,`title` from `' . $mysql->getTableName($this->getTable()) . '` where `id_article`=' . $id_article . ' and `field_name`="' . addslashes($this->ff->getName()) . '"' . (count($arId) ? ' and `id` not in(' . implode(',', $arId) . ')' : null) . ' order by `sort`')) && mysql_num_rows($rs)) {
$rowsToDelete = array();
while ($r = mysql_fetch_assoc($rs)) {
$fieldName = $this->fieldName($r['id']);
if ($isUpdate) {
$this->values[$fieldName] = jpgScheme::VALUE_DELETE;
$rowsToDelete[] = $r['id'];
}
foreach ($this->formats as $param) {
if (!$isUpdate && !$param->hasAttribute('preview')) {
continue;
}
$e = $this->ff->getRootElement()->appendChild($param->cloneNode(true));
$e->setAttribute('name', $fieldName);
$e->setAttribute('uri', str_replace('%IMG_ID%', $r['id'], $e->getAttribute('uri')));
if ($r['title']) {
$e->setAttribute('title', $r['title']);
}
}
}
if ($isUpdate && count($rowsToDelete)) {
$mysql->query('delete from `' . $mysql->getTableName($this->getTable()) . '` where id in(' . implode(',', $rowsToDelete) . ')');
}
}
if ($isUpdate) {
$v = array();
foreach ($this->sortOrder as $i => $str) {
if (preg_match('/id([0-9]+)/', $str, $m)) {
$v[$m[1]] = '(' . $m[1] . ',"' . addslashes($values['exist'][$m[1]]['title']) . '",' . ($i + 1) . ')';
}
}
//vdump($values);
if (count($v)) {
$mysql->query('insert into `' . $mysql->getTableName($this->getTable()) . '` (`id`,`title`,`sort`) values ' . implode(',', $v) . ' on duplicate key update `title`=values(`title`),`sort`=values(`sort`)');
}
}
}