getValue() public method

A convenient SELECT COLUMN function to get a single column value from one row
public getValue ( string $tableName, string $column, integer $limit = 1 ) : mixed
$tableName string The name of the database table to work with.
$column string The desired column
$limit integer Limit of rows to select. Use null for unlimited..1 by default
return mixed Contains the value of a returned column / array of values
Exemplo n.º 1
0
 /**
  * Function to get a total records count
  *
  * @return int
  */
 private function count()
 {
     $res = $this->db->getValue($this->dbTable, "count(*)");
     return $res['cnt'];
 }
Exemplo n.º 2
0
action block's
*/
if (isset($_GET['bank']) and $_GET['bank'] != null) {
    echo "<a href='#' onclick='history.back()'>Вернуться назад</a> <br />";
    $db->where("bank_id", $_GET['bank']);
    $provodki = $db->get("provodki");
    echo '<table class="td-prov"><tbody><tr><td>Дата</td><td>Коментарий</td><td>Сумма</td></tr></tbody>';
    if ($db->count > 0) {
        foreach ($provodki as $prov) {
            $date = datefmt_format($fmt, $prov['date']);
            echo "<tr><td>{$date}</td><td>{$prov['com']}</td><td>{$prov['sum']}</td>";
        }
    }
    echo '</table>';
    $db->where("bank_id", $_GET['bank']);
    $sum = $db->getValue("provodki", "sum(sum)");
    echo "Итого: {$sum} <br />";
    die;
}
//end if(isset($_GET['bank']) and $_GET['bank']!=null)
if (isset($_GET['edit_sob'])) {
    echo "<a href='{$_SERVER["HTTP_REFERER"]}'>Вернуться назад</a> <br />";
    echo "\r\n        <script type='text/javascript'>\r\n            \$(function(){\r\n                // откуда берем данные сформы\r\n                \$('#edit_sob').submit(function(e){\r\n                    //отменяем стандартное действие при отправке формы\r\n                    e.preventDefault();\r\n                    //берем из формы метод передачи данных\r\n                    var m_method=\$(this).attr('method');\r\n                    //получаем адрес скрипта на сервере, куда нужно отправить форму\r\n                    var m_action=\$(this).attr('action');\r\n                    //получаем данные, введенные пользователем в формате input1=value1&input2=value2...,\r\n                    //то есть в стандартном формате передачи данных формы\r\n                    var m_data=\$(this).serialize();\r\n                    \$.ajax({\r\n                        type: m_method,\r\n                        url: m_action,\r\n                        data: m_data,\r\n                        success: function(result){\r\n                            // где показываем результат\r\n                            \$('#sob_result').html(result);\r\n                        }\r\n                    });\r\n                });\r\n            });\r\n        </script>    \r\n        ";
    echo '
                <form action="up_sob.php" method="POST" id="edit_sob">
                <fieldset>
                <legend>Изменение событий</legend>';
    $sob = dbObject::table('sob')->get();
    $db->orderBy("sort", "asc");
    $sob = sob::get();
    //var_dump($sob);
Exemplo n.º 3
0
/**
 * check if user is in admin group
 * @param $chatid
 * @param MysqliDb $db
 * @return bool
 */
function isAdmin($chatid, $db)
{
    $db->where('chatid', $chatid, '=');
    $isadmin = $db->getValue('admins', "count(*)");
    return $isadmin > 0;
}
Exemplo n.º 4
0
include 'core.php';
?>
    
    <?php 
header::all();
?>

    <?php 
// Generate new unique ticket ID by fetching the primary ID of the last ticket &
// using a substring of the time() function to avoid duplicates
// New DB Connection
$db = new MysqliDb($dbserver, $dbusername, $dbpassword, $dbdatabase);
// Order by primary ID descending to ensure we fetch the final table row.
$db->orderBy("primary_id", "desc");
// Fetch the primary ID of the last ticket in the database
$last_ticket = $db->getValue("tickets", "primary_id");
// Create new unique ticket number for this ticket
$new_ticket_number = $last_ticket . substr(time(), 7, 10);
// Get current time in PHP - we use this as a simple method of catching spambots
$spambot_time = time();
?>

<h1 class='mendhub-logo corner-logo'><a href='http://<?php 
echo $_SERVER[HTTP_HOST];
?>
 '>Mend<span class='mendhub-sub-logo'>Hub</span></a></h1>
    
<div class="container-fluid">
    <div class="row">

            <p id="home-strapline">Tell us about a new problem.</p>