本文整理汇总了PHP中DataBase::ExecuteQuery方法的典型用法代码示例。如果您正苦于以下问题:PHP DataBase::ExecuteQuery方法的具体用法?PHP DataBase::ExecuteQuery怎么用?PHP DataBase::ExecuteQuery使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataBase
的用法示例。
在下文中一共展示了DataBase::ExecuteQuery方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getOnePhotoRandom
function getOnePhotoRandom($idalbum)
{
$sql = "SELECT * FROM photos WHERE idalbum=" . $idalbum;
$rs = DataBase::ExecuteQuery($sql, "ARRAY");
$ph = $rs[array_rand($rs, 1)];
$this->setPhoto($ph['idphoto'], $ph['name'], $ph['src'], $ph['title'], $ph['idalbum'], $ph['fecha']);
}
示例2: Render
public static function Render($qry, $list, $orderby, $tampag = 50, $pag){
$original_qry = $qry;
$qry = GridSortPage::SortQuery($qry, $orderby);
$qry = GridSortPage::PaginateQuery($qry, $pag, $tampag);
$matrix = DataBase::ExecuteQuery($qry);
$html = "\n<table>\n";
$html .= GridSortPage::GetHeader($qry);
foreach($matrix as $key => $rows){
$html .= "<tr>";
foreach($rows as $index => $column){
if($key%2 == 0) $html .= "<td>".$column."</td>";
else $html .= "<td class=\"selectedRow\">".$column."</td>";
}
#============================================================================
#============================================================================
#-------
$html .= "<td>";
if(isset($has_header) && $key == 0){
$html .= "Opciones";
}else{
/*$html .= "<ul id=\"sddm\">
<li>
<a href=\"#\" onmouseover=\"mopen('m$key')\" onmouseout=\"mclosetime()\">Opciones</a>
<div id=\"m$key\" onmouseover=\"mcancelclosetime()\" onmouseout=\"mclosetime()\">";*/
foreach($list as $url)
{
if(get_class($url)=='HTMLCheckBox')
$html.=$url->fillfromColumn($rows,"msgs[]",0)."\n";
else
$html .= $url->Render($rows)."\n";
}
$html .= "</div>
</li>
</ul>
<div style=\"clear:both\"></div>";
}
$html .= "</td>";
#-------
$html .= "\n</tr>\n";
if(isset($has_header) && $key ==0) $html .= "</thead>";
}
$html .= "</table>\n";
$html .= GridSortPage::GetNavigationControlsHTML($original_qry, $tampag, $orderby);
return $html;
} #GetHTMLTable
示例3: getOneAlbum
public static function getOneAlbum($idalbum)
{
$ab = null;
$sql = "SELECT a.idalbum, a.descripcion, COUNT(1) nophotos, a.fecha\r\n\t\tFROM albums a, photos p \r\n\t\tWHERE a.idalbum=p.idalbum\r\n\t\tAND a.idalbum=" . $idalbum . "\r\n\t\tGROUP BY a.idalbum, a.descripcion, a.fecha";
$rs = DataBase::ExecuteQuery($sql, "ARRAY");
//if(count($rs)>0)
$ab = new Album($rs[0]['idalbum'], $rs[0]['descripcion'], $rs[0]['nophotos'], $rs[0]['fecha']);
return $ab;
}
示例4: Login
public static function Login ($login_name, $pass, $redirect)
{
$md5pass = md5($pass);
$user_exists = DataBase::ExecuteScalar("SELECT count(1) FROM users WHERE login = '$login_name' AND password = '$md5pass'");
if($user_exists == 1){
$qry = "SELECT * FROM users WHERE login = '$login_name' AND password = '$md5pass'";
//echo $qry;
$row = DataBase::ExecuteQuery($qry);
$_SESSION["user"] = new User($row[0][0], $row[0][1], $row[0][2], $row[0][3], $row[0][4], $row[0][5]);
//print_r($row);
#-----------------------------
echo "<script>window.location = '$redirect'</script>";
}else{
echo "Nombre de Usuario y Contraseña no coinciden, Favor de reintentar.";
}
}
示例5: Load
public static function Load(&$object, $sql)
{
$results = DataBase::ExecuteQuery($sql, "ARRAY");
$keys = array_keys($results[0]);
$string_keys = array();
foreach($keys as $value){
if(!is_int($value))
array_push($string_keys, $value);
}
$row = $results[0];
foreach($string_keys as $value)
$object->$value = $row[$value];
}
示例6: FillDB
function FillDB($qry, $value="")
{
$rows = DataBase::ExecuteQuery($qry);
foreach($rows as $key => $row)
$this->AddItem ($row[0],$row[1]);
}
示例7: count
<?php
$sql = "SELECT idnews,title,fddate FROM news WHERE ambit=1 ORDER BY fddate DESC LIMIT 5";
$rs = DataBase::ExecuteQuery($sql, "ARRAY");
$i = count($rs);
foreach ($rs as $row => $value) {
$class = $row == '0' ? 'class="first"' : '';
echo '<li ' . $class . ' >';
echo '<a href="javascript:;" onclick="get(\'panel_control/viewer_news.php?id=' . $value['idnews'] . '\',\'content\');" >' . $value['title'] . '</a>';
echo '</li>';
}
?>
</ul>
</div>
<div class="box">
<h3>Eventos</h3>
<ul class="list">
<?php
$sql = "SELECT idnews,title,fddate FROM news WHERE ambit=2 ORDER BY fddate DESC LIMIT 5";
$rs = DataBase::ExecuteQuery($sql, "ARRAY");
$i = count($rs);
foreach ($rs as $row => $value) {
$class = $row == '0' ? 'class="first"' : '';
echo '<li ' . $class . ' >';
echo '<a href="javascript:;" onclick="get(\'panel_control/viewer_news.php?id=' . $value['idnews'] . '\',\'content\');" >' . $value['title'] . '</a>';
echo '</li>';
}
?>
</ul>
</div>
</div>