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


PHP runSQL函数代码示例

本文整理汇总了PHP中runSQL函数的典型用法代码示例。如果您正苦于以下问题:PHP runSQL函数的具体用法?PHP runSQL怎么用?PHP runSQL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: exportData

function exportData($WHERE)
{
    $SQL = 'SELECT ' . TBL_DATA . '.*, 
                    ' . TBL_USERS . '.name AS owner, 
                    ' . TBL_MEDIATYPES . '.name AS mediatype,
                    ' . TBL_LENT . '.who AS lentto,
          CASE WHEN ' . TBL_USERSEEN . '.video_id IS NULL THEN 0 ELSE 1 END AS seen
               FROM ' . TBL_DATA . '
          LEFT JOIN ' . TBL_USERS . ' ON ' . TBL_DATA . '.owner_id = ' . TBL_USERS . '.id
          LEFT JOIN ' . TBL_USERSEEN . ' ON ' . TBL_DATA . '.id = ' . TBL_USERSEEN . '.video_id AND ' . TBL_USERSEEN . '.user_id = ' . get_current_user_id() . '
          LEFT JOIN ' . TBL_LENT . ' ON ' . TBL_DATA . '.diskid = ' . TBL_LENT . '.diskid 
          LEFT JOIN ' . TBL_MEDIATYPES . ' ON mediatype = ' . TBL_MEDIATYPES . '.id ' . $WHERE;
    $result = runSQL($SQL);
    // do adultcheck
    if (is_array($result)) {
        $result = array_filter($result, create_function('$video', 'return adultcheck($video["id"]);'));
    }
    // genres
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['genres'] = getItemGenres($result[$i]['id'], true);
    }
    //2015-10-6 Alex ADD start
    // studios
    for ($i = 0; $i < count($result); $i++) {
        $result[$i]['studios'] = getItemStudios($result[$i]['id'], true);
    }
    //2015-10-6 Alex ADD end
    return $result;
}
开发者ID:huya1010,项目名称:videodb,代码行数:29,代码来源:export.core.php

示例2: countRec

function countRec($fname, $where)
{
    //$sql = "SELECT count($fname) FROM $tname ";
    $sql = "SELECT count({$fname})\n        FROM ticket_delivery a LEFT JOIN agent b ON a.agent_id = b.id\n        LEFT JOIN ticket_delivery_user c on a.user_id = c.id {$where}";
    $result = runSQL($sql);
    return $result[0][0];
}
开发者ID:hardikk,项目名称:HNH,代码行数:7,代码来源:delivery_tab.php

示例3: countRec

function countRec($fname, $tname)
{
    $sql = "SELECT count({$fname}) FROM {$tname} ";
    $result = runSQL($sql);
    while ($row = mysql_fetch_array($result)) {
        return $row[0];
    }
}
开发者ID:tyxing007,项目名称:jshoperv2,代码行数:8,代码来源:post.php

示例4: __construct

 public function __construct($user_id)
 {
     $result = runSQL("select * from users where id = '{$user_id}'");
     $user = mysql_fetch_array($result);
     $this->id = $user['id'];
     $this->name = $user['first_name'] . ' ' . $user['last_name'];
     $this->email = $user['email'];
     $this->username = $user['username'];
 }
开发者ID:Tokhin,项目名称:tokinMama,代码行数:9,代码来源:lib.php

示例5: create_user

/**
 * Create user
 *
 * @param string $user Username
 * @param string $pass Password
 * @param string $perm permission as integer
 * @return boolean     true on success
 */
function create_user($user, $pass, $perm, $email)
{
    global $config;
    // acquire next free "real" user-id
    $SQL = "SELECT (MAX(id)+1) AS id FROM " . TBL_USERS . " WHERE id != " . $config['guestid'] . ";";
    $res = runSQL($SQL);
    $nextid = $res[0]['id'];
    $SQL = "INSERT INTO " . TBL_USERS . "\n               SET id = " . $nextid . ",\n               \t   name = '" . addslashes($user) . "',\n                   passwd = '" . md5($pass) . "',\n                   permissions = {$perm},\n                   email = '" . addslashes($email) . "'";
    $res = runSQL($SQL, false);
    // set default read/write permissions for own data
    if ($res !== false) {
        $SQL = 'REPLACE INTO ' . TBL_PERMISSIONS . " \n                    SET from_uid=" . $nextid . ", to_uid=" . $nextid . ", permissions=" . PERM_READ . "|" . PERM_WRITE;
        $res = runSQL($SQL, false);
    }
    return $res;
}
开发者ID:Boris-de,项目名称:videodb,代码行数:24,代码来源:users.php

示例6: printItems

function printItems($UID, $hours)
{
    //	date_default_timezone_set("America/New_York");
    //	$sql = "SELECT A.id, A.url, A.title, A.body, A.viewed, B.name, B.url as feedurl,
    //			 UNIX_TIMESTAMP(A.dt) as unix_time
    //	$sql = "SELECT A.id, A.url, A.title, A.body, A.viewed, B.name, B.url as feedurl,
    //                       DATE_FORMAT(A.dt, '%H:%i') as time,
    //                       DATE_FORMAT(A.dt, '%W %D %M %Y') as date
    $sql = "SELECT A.id, A.url, A.title, A.body, A.viewed, B.name, B.url as feedurl,\n\t\t\t UNIX_TIMESTAMP(A.dt) as timestamp\n                 FROM lylina_items A, lylina_feeds B, lylina_userfeeds C\n                WHERE B.id = A.feed_id\n                  AND B.id = C.feed_id\n                  AND C.user_id = {$UID}\n                  AND UNIX_TIMESTAMP(A.dt) > UNIX_TIMESTAMP()-({$hours}*60*60)\n             ORDER BY A.dt DESC, A.title";
    $items = runSQL($sql);
    //    foreach($items as $item){
    //        formatItem($item);
    //    }
    for ($n = 0; $n < count($items); $n++) {
        //		$items[$n]['time'] = date("H:i", $items[$n]['unix_time'] + date('Z'));
        //		$items[$n]['date'] = date("l F j, Y", $items[$n]['unix_time'] + date('Z'));
        formatItem($items[$n], $n);
    }
}
开发者ID:eharmon,项目名称:yelly,代码行数:19,代码来源:itemDisplay.inc.php

示例7: channelFavicon

function channelFavicon($location)
{
    $empty_ico_data = base64_decode('AAABAAEAEBAAAAEACABoBQAAFgAAACgAAAAQAAAAIAAAAAEACAAAAAAAQAEAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAA////AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA' . 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP//AAD//wAA//8AAP//AAD//wAA//8AAP//' . 'AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAA=');
    //	$ico_url = getFaviconURL($location) ;
    //	if(!$ico_url) {
    //		return false ;
    //	}
    $sql = "SELECT favicon_url FROM lylina_feeds WHERE url = '" . $location . "'";
    $result = runSQL($sql);
    //	$cached_ico = './favicons/' . md5($ico_url) . ".ico" ;
    $cached_ico = './favicons/' . md5($result[0]['favicon_url']) . ".ico";
    $cachetime = 7 * 24 * 60 * 60;
    // 7 days
    // echo "<br> $ico_url , $cached_ico " ;
    // Serve from the cache if it is younger than $cachetime
    clearstatcache();
    // Clear the file stat cache in case we already recached the ico
    if (file_exists($cached_ico) && time() - filemtime($cached_ico) < $cachetime) {
        return $cached_ico;
    } else {
        $ico_url = getFaviconURL($location);
        if (!$ico_url) {
            return false;
        }
        if ($ico_url != $result['favicon_url']) {
            $sql = "UPDATE lylina_feeds SET favicon_url = '" . $ico_url . "' WHERE url ='" . $location . "'";
            runSQL($sql);
        }
        $cached_ico = './favicons/' . md5($ico_url) . ".ico";
        if (!($data = @file_get_contents($ico_url))) {
            $data = $empty_ico_data;
        }
        if (stristr($data, 'html')) {
            $data = $empty_ico_data;
        }
        $fp = fopen($cached_ico, 'w');
        fputs($fp, $data);
        fclose($fp);
        return $cached_ico;
    }
}
开发者ID:eharmon,项目名称:yelly,代码行数:41,代码来源:display.php

示例8: getRevenue

function getRevenue($date_to, $gameID)
{
    if ($gameID == "CARO") {
        $database_name = "gametrans_MPCARO";
    } elseif ($gameID == "10HA7") {
        $database_name = "gametrans_VC";
    } else {
        $database_name = "gametrans_{$gameID}";
    }
    $param = $date_to;
    $table = date("Ymd", strtotime($param));
    $table_sms = $gameID . "_sms_" . $table;
    $table_sms_user = "sms_user_" . $table;
    $table_mcard = "card123_verify_" . $table;
    $table_mcard_user = "card123_user_" . $table;
    $table_zcard = "cardzing_verify_" . $table;
    $table_zcard_user = "cardzing_user_" . $table;
    $table_atm = "atm_queryorder_" . $table;
    $table_atm_user = "atm_createorder_" . $table;
    //////////////////////// ATM ///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    $list = array();
    $sql_atm = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.totalAmount) as revenue_gross,SUM(t1.opAmount) as revenue_net FROM {$table_atm} t1, {$table_atm_user} t2 WHERE t1.mTransactionID = t2.mTransactionID \nAND t1.transactionStatus = '1' AND t2.gameID = '{$gameID}' ";
    $row_atm = runSQL($sql_atm);
    $sql_zcard = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.cardvalue) as revenue_gross,SUM(t1.cardvalue) as revenue_net FROM {$table_zcard} t1 WHERE t1.verify = '1' AND t1.gameID = '{$gameID}' ";
    $row_zcard = runSQL($sql_zcard);
    $sql_mcard = "SELECT COUNT(t1.mTransactionID) as qty,SUM(t1.grossAmount) as revenue_gross,SUM(t1.netAmount) as revenue_net FROM {$table_mcard} t1 WHERE t1.groupResponseCode = '1' AND t1.gameID = '{$gameID}' ";
    $row_mcard = runSQL($sql_mcard);
    $sql_sms = "SELECT COUNT(t1.requestid) as qty,SUM(t1.money) as revenue_gross,SUM(t1.net_money) as revenue_net FROM {$table_sms} t1 \n ";
    $row_sms = runSQL_sms($sql_sms, $database_name);
    $list['atm'] = $row_atm;
    $list['zcard'] = $row_zcard;
    $list['mcard'] = $row_mcard;
    $list['sms'] = $row_sms;
    // $result = json_encode($list);
    // savefile($result, $name_file_log);
    return $list;
}
开发者ID:vampiregrodon,项目名称:TutorialGit,代码行数:37,代码来源:backend_manual.php

示例9: runUpdate

function runUpdate($name, $version)
{
    global $UPDATES_PATH;
    log_update("Running update {$name}.{$version}");
    $fileSQL = "{$name}.{$version}.sql";
    $fileSH = "{$UPDATES_PATH}/{$name}.{$version}.sh";
    log_update("Checking SQL...");
    if (file_exists("{$UPDATES_PATH}/{$fileSQL}")) {
        log_update("... SQL file found: {$fileSQL}");
        runSQL($fileSQL);
    } else {
        log_update("... This update doesn't contain any SQL");
    }
    log_update("Checking shell script...");
    if (file_exists($fileSH)) {
        log_update("... Shell script found: {$fileSH}");
        $output = shell_exec($fileSH);
        if ($output) {
            log_update($output);
        }
    } else {
        log_update("... This update doesn't contain any shell script");
    }
}
开发者ID:Naghasan,项目名称:Volumio-WebUI,代码行数:24,代码来源:run_updates.php

示例10: countRec

function countRec($fname, $tname)
{
    $sql = "SELECT count({$fname}) FROM {$tname} ";
    $result = runSQL($sql);
    return $result[0][0];
}
开发者ID:hardikk,项目名称:HNH,代码行数:6,代码来源:phonebook_tab.php

示例11: on

                     $str .= '<tr><td style="padding-left:10px;height:15px;">Instituição: </td><td style="padding-left:10px;"> ' . $nomeInst . ' (' . $sigla . ') </td></tr>';
                     // Caso 2: possui inst/campus
                 } else {
                     $sql2 = "SELECT ca.nome as nomeCampus, i.nome as nomeInst, i.sigla\r\n\t\t\t\t\t\tFROM campus ca\r\n\t\t\t\t\t\tINNER JOIN instituicao i on (i.id_instituicao = '" . $arr["fk_instituicao"] . "')\r\n\t\t\t\t\t\tWHERE ca.id_campus = " . $arr["fk_campus"];
                     $result2 = runSQL($sql2);
                     $arr2 = mysql_fetch_array($result2);
                     $nomeCampus = stripslashes($arr2["nomeCampus"]);
                     $nomeInst = stripslashes($arr2["nomeInst"]);
                     $sigla = stripslashes($arr2["sigla"]);
                     $str .= '<tr><td style="padding-left:10px;height:15px;"> Campus: </td><td style="padding-left:10px;"> ' . $nomeCampus . '</td></tr>';
                     $str .= '<tr><td style="padding-left:10px;height:15px;"> Instituição: </td><td style="padding-left:10px;"> ' . $nomeInst . ' (' . $sigla . ') </td></tr>';
                 }
                 // Caso 3: possui inst
             } else {
                 $sql2 = "SELECT nome as nomeInst, sigla\r\n\t\t\t\t\tFROM instituicao\r\n\t\t\t\t\tWHERE id_instituicao = " . $arr["fk_instituicao"];
                 $result2 = runSQL($sql2);
                 $arr2 = mysql_fetch_array($result2);
                 $nomeInst = stripslashes($arr2["nomeInst"]);
                 $sigla = stripslashes($arr2["sigla"]);
                 $str .= '<tr><td style="padding-left:10px;height:15px;"> Instituição: </td><td style="padding-left:10px;"> ' . $nomeInst . ' (' . $sigla . ') </td></tr>';
             }
         }
         echo $str;
         exit;
     } else {
         if (isset($_POST["opcao"]) && $_POST["opcao"] == "logout") {
             session_destroy();
             echo 1;
         }
     }
 }
开发者ID:alexdiasgonsales,项目名称:organizador,代码行数:31,代码来源:usuario_op.php

示例12: countRec

function countRec($_field, $_table, $_where = false)
{
    try {
        $_query = runSQL("SELECT count(" . $_field . ") AS count FROM " . $_table . " " . $_where, "mysql");
        $_response = mysql_fetch_assoc($_query);
        return $_response["count"];
    } catch (Exception $e) {
        echo "#" . $e->getMessage() . ": Algum erro ocorreu.";
        echo "<br />";
        print_r($e->getTrace());
        exit;
    }
}
开发者ID:GlobalSistemasWeb,项目名称:ValidaCom,代码行数:13,代码来源:conexao.class.php

示例13: editar_cad_usuario

function editar_cad_usuario($id, $nome, $email, $senha, $cpf)
{
    if ($senha != "") {
        $senha2 = MD5($senha);
    } else {
        $mantemSenha = "SELECT senha\r\n\t\t\t\t\t\tFROM usuario\r\n\t\t\t\t\t\tWHERE id_usuario=" . $id;
        $resultSenha = runSQL($mantemSenha);
        $linha_senha = mysql_fetch_array($resultSenha);
        $senha2 = $linha_senha["senha"];
    }
    $sql = "UPDATE usuario\r\n            SET\r\n            nome = '" . $nome . "',\r\n            email = '" . $email . "',\r\n            senha = '" . $senha2 . "'\r\n            WHERE id_usuario = " . $id;
    $result = runSQL($sql);
    if ($result != false) {
        $nome = stripslashes($nome);
        $email = stripslashes($email);
        $senha = stripslashes($senha);
        // envio do email
        /*  $sHeader = "From: mostratec@poa.ifrs.edu.br\n";
        	  $sBody = $nome."\n";
              $sBody = "Registro de Alteração de Dados:\n\n";
        	  $sBody .= "Nome: ".$nome."\n";
        	  $sBody .= "Email: ".$email."\n";
        	  $sBody .= "Para entrar no sistema:\n";
              $sBody .= "CPF: ".$cpf."\n";
              $sBody .= "Senha: ".$senha."\n";
              $sBody .= "Link: http://mostratec.poa.ifrs.edu.br/2012  \n";
              $sTo = $email;
              $sSubject = " Alteração de Dados - Mostratec (".$nome.") ";
              $Envio = mail ($sTo, $sSubject, $sBody, $sHeader) ; */
        $_SESSION['nome_usuario'] = $nome;
        $ans = 1;
    } else {
        $ans = 0;
    }
    return $ans;
}
开发者ID:alexdiasgonsales,项目名称:organizador,代码行数:36,代码来源:usuario_alterarDados.php

示例14: setup_getGenres

/** 
 * Genres
 */
function setup_getGenres()
{
    $SELECT = 'SELECT id, name
                 FROM ' . TBL_GENRES . '
             ORDER BY name';
    $result = runSQL($SELECT);
    return array_associate($result, 'id', 'name');
}
开发者ID:Boris-de,项目名称:videodb,代码行数:11,代码来源:setup.core.php

示例15: runSQLfetchAll

<?php

$id = $_GET["id"];
$task = runSQLfetchAll("SELECT * FROM task WHERE id = :id", array(":id" => $id));
$task = $task[0];
$current_date = time() * 1000;
if ($task["start_date"] * 1 > 0) {
    // если задача уже была запущена, то перещитаем ей время в пауз
    $pause_summ = +$task["pause_summ"];
    $pause_date = +$task["pause_date"];
    if ($pause_date * 1 > 0) {
        $diff = $current_date - $pause_date;
    } else {
        $diff = 0;
    }
    $pause_summ += $diff;
    runSQL("UPDATE task SET pause_date = 0, pause_summ = :pause_summ WHERE id = :id", array(":id" => $id, ":pause_summ" => $pause_summ));
    $task["pause_date"] = 0;
    $task["pause_summ"] = +$pause_summ;
} else {
    // если задача ни разу не была запущена, то сетим ей дату начала
    runSQL("UPDATE task SET pause_date = 0, start_date = :start_date WHERE id = :id", array(":id" => $id, ":start_date" => $current_date));
    $task["start_date"] = +$current_date;
    $task["pause_date"] = 0;
}
echo json_encode(array("task" => $task));
开发者ID:eprincev-egor,项目名称:task,代码行数:26,代码来源:taskPlay.php


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