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


PHP Mysql::select方法代码示例

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


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

示例1: find

 /**
  * Basic find models, uses $where as array of conditions
  * $order and $limit to make query
  *
  * @param array $where
  * @param string $order
  * @param string $limit
  * @return \Collection
  */
 public static function find(array $where = null, $order = null, $limit = null)
 {
     if ($sql = Mysql::prepareSelect(static::getTable(), $where, $order, $limit)) {
         return Mysql::select($sql, get_called_class());
     }
     return null;
 }
开发者ID:smith46102,项目名称:koda,代码行数:16,代码来源:model.php

示例2: getUserId

 * User: shaoting
 * Date: 15/7/26
 * Time: 下午5:25
 */
include "../Visitor.php";
$_GET['userId'] = getUserId();
$KeyList = array('userId', 'footprintId');
foreach ($KeyList as $k => $v) {
    if (!isset($_GET[$v])) {
        $res = ['ok' => 0, 'error' => "param invalid "];
        echo json_encode($res);
        die;
    }
}
$mysql = new Mysql();
$result = $mysql->select("*", "footprint", "`footId`", "'{$_GET['footprintId']}'");
if ($result) {
    if ($result['userId'] == $_GET['userId']) {
        $myMemcache = new MyMemcache();
        $footprintId = $result['id'];
        $removeFootprint = "delete from footprint where id={$footprintId}";
        //echo $removeFootprint;
        $mysql->query($removeFootprint);
        $myMemcache->delete($_GET['userId'] . "foot" . $result['footId']);
        if ($myMemcache->get("like" . $result['footId']) && $myMemcache->get("like" . $result['footId']) == 1) {
            //$removeFoot="delete from foot where id={$result['footId']}";
            //$mysql->query($removeFoot);
        }
        echo json_encode(['ok' => 1]);
    } else {
        echo json_encode(['ok' => 0, 'error' => "no permission"]);
开发者ID:shaoshao613,项目名称:footprint,代码行数:31,代码来源:remove.php

示例3: Mysql

        $res = ['ok' => 0, 'error' => $error];
        echo json_encode($res);
        die;
    }
    if (isset($key)) {
        $key .= ",`" . $v . "`";
        $value .= ",'" . mysql_real_escape_string($_POST[$v]) . "'";
    } else {
        $key = "`" . $v . "`";
        $value = "'" . mysql_real_escape_string($_POST[$v]) . "'";
    }
}
$mysql = new Mysql();
//连接数据库
$userName = $_POST['userName'];
$result = $mysql->select("*", 'user', '`username`', "'{$userName}'");
if (!$result) {
    $mysql->replace("user", "{$key}", "{$value}");
    $userId = mysql_insert_id();
    $mysql->close();
} else {
    $res = ['ok' => 0, 'error' => 'username existed'];
    echo json_encode($res);
    die;
}
$myMemcache = new MyMemcache();
$expireTime = 7 * 24 * 3600;
$token = md5(uniqid(rand(), TRUE));
$myMemcache->set("u" . $userId, $token, $expireTime);
$myMemcache->set($token, $userId, $expireTime);
$myMemcache->close();
开发者ID:shaoshao613,项目名称:footprint,代码行数:31,代码来源:register.php

示例4: json_encode

<?php

/**
 * Created by PhpStorm.
 * User: shaoting
 * Date: 15/7/26
 * Time: 下午9:57
 */
include "../Visitor.php";
$userId = getUserId();
$mysql = new Mysql();
$result = $mysql->select("*", "`user_regular`", "`user_id`", "{$userId}");
if ($result) {
    //echo "SELECT * FROM user_regular u inner join regular r WHERE r.id=u.regular_id and u.user_id={$userId}";
    $regular_array = $mysql->query_array("select * from (SELECT u.*,r.host,r.threshold FROM user_regular u inner join regular r WHERE r.id=u.regular_id and u.user_id={$userId} order by time desc ) a group by host");
} else {
    //echo "select * from (SELECT *,count(r.id) count FROM user_regular u inner join regular r WHERE r.id=u.regular_id group by r.id)a limit 10";
    //无规则时返回大家用的最多的规则
    $regular_array = $mysql->query_array("select * from (SELECT u.*,r.host,r.threshold,count(r.id) count FROM user_regular u inner join regular r WHERE r.id=u.regular_id group by r.id)a group by host order by time desc limit 10");
}
foreach ($regular_array as $v) {
    $regular = new Regular($v);
    $regulars[] = $regular;
}
$res = [ok => 1, data => $regulars];
echo json_encode($res);
开发者ID:shaoshao613,项目名称:footprint,代码行数:26,代码来源:list.php

示例5: fetchAll

 public static function fetchAll()
 {
     return Mysql::select('SELECT * FROM music');
 }
开发者ID:Brunoalves3,项目名称:bruno,代码行数:4,代码来源:MusicTable.php

示例6: select

{
    public function select()
    {
        echo 'The class "', __METHOD__, '" was initiated!<br />';
    }
}
class Mssql extends Database
{
    public function connect()
    {
        echo 'The class "', __METHOD__, '" was initiated! User : ' . $this->user . ' Pass : ' . $this->pass . '<br />';
    }
    public function select()
    {
        echo 'The class "', __METHOD__, '" was initiated!<br />';
    }
}
$db = new Mysql();
$db->authentication('root', 'root');
$db->connect();
$db->select();
echo "<hr>";
$db = new Postgresql();
$db->authentication('root', 'root');
$db->connect();
$db->select();
echo "<hr>";
$db = new Mssql();
$db->authentication('ali', 'root');
$db->connect();
$db->select();
开发者ID:yalcinemree,项目名称:ootest,代码行数:31,代码来源:index.php


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