当前位置: 首页>>代码示例>>PHP>>正文


PHP SQL::Query方法代码示例

本文整理汇总了PHP中SQL::Query方法的典型用法代码示例。如果您正苦于以下问题:PHP SQL::Query方法的具体用法?PHP SQL::Query怎么用?PHP SQL::Query使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SQL的用法示例。


在下文中一共展示了SQL::Query方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: ShowList

 private function ShowList($list)
 {
     $groups_array = GroupModel::GetList();
     $groups_array[0] = 'Не определено';
     $regions_array = RegionModel::GetList();
     $regions_array[0] = 'Вся Россия';
     $companys = SQL::Query('SELECT * FROM `companys` WHERE `id` IN (' . $list . ') ORDER BY `rate` DESC')->fetchAll(PDO::FETCH_OBJ);
     $this->Render('index', ['company' => $this->company, 'companys' => $companys, 'group_tags' => $groups_array, 'region_tags' => $regions_array]);
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:9,代码来源:FavoritesController.php

示例2: Get

 public static function Get($group_id = 0, $word = '')
 {
     if ($word != '') {
         $res = SQL::Query('SELECT * FROM adw_words WHERE word Like ?', [0 => '%' . $word . '%'])->fetch(PDO::FETCH_OBJ);
     } else {
         $res = SQL::Query('SELECT * FROM adw_groups WHERE group_id = ?', [0 => $group_id])->fetch(PDO::FETCH_OBJ);
     }
     return SQL::Count() > 0 ? CompanyModel::GetObj()->id($res->company_id) : null;
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:9,代码来源:AdwareModel.php

示例3: GetSimmilar

 private function GetSimmilar()
 {
     $search_tags = '';
     $tmp = explode(',', $this->company->tags);
     foreach ($tmp as $key => $value) {
         $search_tags .= '"' . trim($value) . '"';
     }
     return SQL::Query('SELECT * FROM `companys` WHERE MATCH (name, about, tags) AGAINST (? IN BOOLEAN MODE) AND id != ? AND group_id = ? LIMIT 5', [0 => $search_tags, 1 => $this->company->id, 2 => $this->company->group_id])->fetchAll(PDO::FETCH_OBJ);
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:9,代码来源:ProfileController.php

示例4: IndexAction

 public function IndexAction()
 {
     $top = CompanyModel::GetAll('id, name')->order('rate DESC', 10);
     $top_groups = GroupModel::GetAll('id, name')->order('qty DESC', 10);
     $last_company = CompanyModel::GetObj()->where('id = (select max(id) from companys)');
     $products = SQL::Query('SELECT * FROM `products` ORDER BY id DESC LIMIT 3')->fetchAll(PDO::FETCH_OBJ);
     $company_count = SQL::Query('SELECT count(*) as total FROM `companys`')->fetch(PDO::FETCH_OBJ)->total;
     $groups_count = SQL::Query('SELECT count(*) as total FROM `groups`')->fetch(PDO::FETCH_OBJ)->total;
     Site::$sub = '<div class="div30 center">' . "\n" . 'Компаний на портале <h1><a href="' . Site::Link('list') . '">' . $company_count . '</a></h1>' . "\n" . '</div>' . "\n" . '<div class="div30 center">' . "\n" . 'Сфер деятельности <h1><a href="' . Site::Link('list/setgroup') . '">' . $groups_count . '</a></h1>' . "\n" . '</div>' . "\n";
     $this->render('index', ['top_arr' => $top, 'top_groups' => $top_groups, 'last' => $last_company, 'products' => $products]);
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:11,代码来源:MainController.php

示例5: start

 public function start()
 {
     if (User::isLogged() == false) {
         Site::Message('Неверная ссылка');
         $this->route();
     } else {
         $this->company = CompanyModel::GetObj()->id(User::company());
         if ($this->company->id == 0) {
             SQL::Query('INSERT INTO `companys` (id) VALUES (null);');
             $this->company->id = SQL::$db->lastInsertId();
             $user = UserModel::GetObj()->id(User::GetID());
             $user->companyid = $this->company->id;
             $user->save();
         }
     }
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:16,代码来源:NewcompanyController.php

示例6: UpdateAction

 public function UpdateAction()
 {
     Site::Message('Обновление файла sitemap.xml');
     $companys = SQL::Query('SELECT id FROM `companys` ORDER BY id;')->FetchAll(PDO::FETCH_OBJ);
     $sitelink = Site::link();
     $this->sitemap = '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">' . "\n";
     $this->addurl($sitelink);
     $this->addurl($sitelink . 'list');
     $this->addurl($sitelink . 'list/setgroup');
     $this->addurl($sitelink . 'feedback');
     foreach ($companys as $company) {
         $this->addurl($sitelink . $company->id);
     }
     $this->sitemap .= '</urlset>';
     file_put_contents('./sitemap.xml', $this->sitemap);
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:16,代码来源:SitemapController.php

示例7: CreateAddLabels

 /**
  * Create Labels  
  *
  * @version 1
  * @author Rick de Man <rick@rickdeman.nl>
  *
  * @param string $S
  *          Place offset for each Line
  * @return number|string
  * 		
  */
 public function CreateAddLabels($S)
 {
     // File to be loaded
     $File = __DIR__ . '/' . $this->ClassName . '/' . $this->Template . '/labels.html';
     // Validate file exists
     if (!file_exists($File)) {
         return 500;
     }
     // Load the Contents of the file
     $Template = file_get_contents($File);
     // Query Setup
     $Query = 'SELECT * FROM `%component_messages_labels` WHERE 1';
     $Comment = 'Loading message Labels';
     $Values = array($this->User['ID']);
     // Prepare the SQL statement
     $Labels = $this->SQL->Query($Query, $Comment, true);
     // Let the Template Builder create the content
     return placeOffset($S, WMS::Html_TemplateBuilder($this, $Template, $Labels));
 }
开发者ID:RickdeM,项目名称:wms,代码行数:30,代码来源:messages.php

示例8: print_r

<?php

require 'lib/globals.php';
print_r(SQL::Query(1, 'QUERY', 'PARAMS', array('DBHost' => 'localhost', 'DBName' => 'noz_db', 'DBUser' => 'root', 'DBPass' => 'abc123')));
开发者ID:Nozemi,项目名称:MyFramework,代码行数:4,代码来源:example_pdo.php

示例9: SingleQuery

 public static function SingleQuery($sql)
 {
     SQL::Query($sql);
     SQL::execute();
     if (SQL::RowCount() > 0) {
         return SQL::DecryptSingleArray(SQL::$stmt->fetch(PDO::FETCH_ASSOC));
     } else {
         return SQL::$stmt->fetch(PDO::FETCH_ASSOC);
     }
 }
开发者ID:varcor,项目名称:libPHPSQL-PDO,代码行数:10,代码来源:SQL.class.php

示例10: TagSearch

 public static function TagSearch($search, $limit = 15, $offset = 0)
 {
     return SQL::Query('SELECT SQL_CALC_FOUND_ROWS * FROM `companys` WHERE tags LIKE ? ORDER BY `rate` DESC LIMIT ' . $limit . ' OFFSET ' . $offset, [0 => '%' . $search . '%'])->fetchAll(PDO::FETCH_OBJ);
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:4,代码来源:CompanyModel.php

示例11: Upload

     * Upload a file by URL
     * 
     * @param url url to upload to imagescript
     */
    case 'uploadByURL':
        if (!isset($_GET['url'])) {
            echo "-20 URL not set!";
            break;
        }
        $upload = new Upload();
        echo $upload->byURL($_GET['url']);
        break;
    case 'getImage':
        if (!isset($_GET['image']) || !is_numeric($_GET['image'])) {
            echo "-10 Image id not valid";
            break;
        }
        $result = SQL::Query("SELECT * FROM images" . " WHERE id = '" . $_GET['image'] . "' LIMIT 1");
        if ($result->num_rows == 0) {
            echo "-11 No image at this ID!";
            break;
        }
        echo json_encode($result->fetch_assoc());
        break;
    default:
        if (isset($_GET['do'])) {
            echo "-10 Operation '" . $_GET['do'] . "' not valid!";
        } else {
            echo "-11 No operation set!";
        }
}
开发者ID:valderman,项目名称:izwei,代码行数:31,代码来源:ajax.php

示例12: Dec

 public static function Dec($id)
 {
     if ($id != 0) {
         SQL::Query('UPDATE `groups` SET qty = qty - 1 WHERE id = ? LIMIT 1', [0 => $id]);
     }
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:6,代码来源:GroupModel.php

示例13: GetList

 public static function GetList()
 {
     $arr = array();
     $STH = SQL::Query('SELECT id, name FROM ' . static::TableName());
     if ($STH->rowCount() > 0) {
         $arr = $STH->fetchAll(PDO::FETCH_KEY_PAIR);
     }
     return $arr;
 }
开发者ID:kekstlt,项目名称:promspace,代码行数:9,代码来源:activerecord.php

示例14: MessageHandler

										<tr>
											<td>Config::cKey()</td>
											<td>String <strong>KeyName</strong>, Array <strong>ContainingKeyName</strong></td>
											<td>This function will get the variable that the <strong>KeyName</strong> is holding.
											This is useful when you know the key is in the array, but do not want to "navigate" all
											the way through the array manually. <strong>This will return a string or array</strong>.</td>
											<td>Config::cKey('SiteTitle', Config::C());</td>
										</tr>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
				<hr>
				<?php 
$result = SQL::Query(2, 'SELECT `usernae` FROM `test` LIMIT 10');
if ($result['Success'] === false) {
    if (class_exists('MessageHandler')) {
        new MessageHandler($result['Result'], 'ERR');
    } else {
        echo $result['Result'];
    }
}
?>
			</div>
			<div class="col-lg-2"></div>
		</div>
	</div>
</body>
</html>
开发者ID:Nozemi,项目名称:MyFramework,代码行数:31,代码来源:index.php

示例15: Action_Navbar

 /**
  * Action:Message - Message drop down for navigation bar
  *
  * @version 1
  * @author Rick de Man <rick@rickdeman.nl>
  *        
  */
 protected function Action_Navbar()
 {
     // Variable for the Result
     $Result = '';
     // User must be Signed in
     if ($this->User['loggedIn'] !== true) {
         return $Result;
     }
     // Load all Messages
     $Messages = $this->SQL->Query('SELECT * FROM `%component_tasks` WHERE Assignee LIKE \'%"' . $this->User['ID'] . '"%\' AND Parent = 0 AND Completed < 100 Limit 10', 'Loading messages for current User', true);
     // Load the 'Start' in a simple variable
     $S = $this->S;
     // Item Counter 0-9, 9+
     $Count = $Messages !== false ? '<em>' . (count($Messages) > 9 ? '9+' : count($Messages)) . '</em>' : '';
     // Max message Length
     $MaxLenght = $this->Settings->NavbarMessageLenght->value;
     if (isset($this->Attributes['NavbarMessageLenght'])) {
         $MaxLenght = intval($this->Attributes['NavbarMessageLenght']);
     }
     $Result .= $S . "<li class='dropdown'>" . EOL;
     $Result .= $S . '	<a class="dropdown-toggle" data-toggle="dropdown" href="#"><i class="fa fa-tasks fa-fw"></i>' . $Count . ' <i class="fa fa-caret-down"></i></a>' . EOL;
     // Messages
     if (is_array($Messages)) {
         // Load all usernames
         //$this->GetUserNames ( $Messages );
         $Result .= $S . '	<ul class="dropdown-menu dropdown-tasks dropdown-items">' . EOL;
         // Create the messages
         foreach ($Messages as $K => $V) {
             if (strlen($V['Description']) > $MaxLenght) {
                 $Description = $V['Description'];
                 $Description = substr($Description, 0, $MaxLenght);
                 if (preg_match('/.([\\w]{0,})[ ]{1,}$/', $Description, $Match)) {
                     $Description = substr($Description, 0, -strlen($Match[0])) . '...';
                 }
                 $V['Description'] = $Description;
             }
             $Task = '<strong>' . $V['Name'] . '</strong>';
             $Progress = '<span class="pull-right text-muted">' . $V['Completed'] . '% ' . $this->Language->Complete . '</span></p>';
             $Aria = 'aria-valuenow="' . $V['Completed'] . '" aria-valuemin="0" aria-valuemax="100"';
             $ProgressBar = '';
             foreach ($this->ProgressScale as $Key => $Value) {
                 if ($V['Completed'] >= $Key) {
                     $ProgressBar = $Value;
                 }
             }
             $Result .= $S . '		<li>' . EOL;
             $Result .= $S . '			<a href="' . $this->ComponentUrl . 'View/' . $V['ID'] . '">' . EOL;
             $Result .= $S . '				<p>' . $Task . $Progress . EOL;
             $Result .= $S . '				<div class="progress progress-striped active">' . EOL;
             $Result .= $S . '					<div class="progress-bar progress-bar-' . $ProgressBar . '" role="progressbar" ' . $Aria . ' style="width: ' . $V['Completed'] . '%"></div>' . EOL;
             $Result .= $S . '				</div>' . EOL;
             $Result .= $S . '			</a>' . EOL;
             $Result .= $S . '		</li>' . EOL;
             // Ad a divided at the last message
             if ($K + 1 !== count($Messages)) {
                 $Result .= $S . '		<li class="divider"></li>' . EOL;
             }
         }
         $Result .= $S . '	</ul>' . EOL;
     }
     // Read all Tasks
     $Result .= $S . '	<ul class="dropdown-menu dropdown-messages dropdown-footer">' . EOL;
     $Result .= $S . '		<li>' . EOL;
     $Result .= $S . '			<a class="text-center" href="' . $this->ComponentUrl . 'ViewAll/">' . EOL;
     $Result .= $S . '				<strong>' . $this->Language->ShowAllMessages . '</strong>' . EOL;
     $Result .= $S . '			</a>' . EOL;
     $Result .= $S . '		</li>' . EOL;
     $Result .= $S . '	</ul>' . EOL;
     $Result .= $S . '</li>&nbsp;<!--Minify-->' . EOL;
     // Return HTML
     return $Result;
 }
开发者ID:RickdeM,项目名称:wms,代码行数:79,代码来源:tasks.php


注:本文中的SQL::Query方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。