本文整理汇总了PHP中Database::num_row方法的典型用法代码示例。如果您正苦于以下问题:PHP Database::num_row方法的具体用法?PHP Database::num_row怎么用?PHP Database::num_row使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Database
的用法示例。
在下文中一共展示了Database::num_row方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ShowMenuFiche
function ShowMenuFiche($p_dossier)
{
$cn = new Database($p_dossier);
$mod = "&ac=" . $_REQUEST['ac'];
$str_dossier = dossier::get() . $mod;
echo '<div class="lmenu">';
echo '<TABLE>';
echo '<TR><TD colspan="1" class="mtitle" style="width:auto" >
<A class="mtitle" HREF="?p_action=fiche&action=add_modele&fiche=modele&' . $str_dossier . '">' . _('Création') . '</A></TD>
<TD><A class="mtitle" HREF="?p_action=fiche&' . $str_dossier . '">' . _('Recherche') . '</A></TD>
</TR>';
$Res = $cn->exec_sql("select fd_id,fd_label from fiche_def order by fd_label");
$Max = Database::num_row($Res);
for ($i = 0; $i < $Max; $i++) {
$l_line = Database::fetch_array($Res, $i);
printf('<TR><TD class="cell">
<A class="mtitle" HREF="?p_action=fiche&action=modifier&fiche=%d&%s">%s</A></TD>
<TD class="mshort">
<A class="mtitle" HREF="?p_action=fiche&action=vue&fiche=%d&%s">Liste</A>
</TD>
</TR>', $l_line['fd_id'], $str_dossier, $l_line['fd_label'], $l_line['fd_id'], $str_dossier);
}
echo "</TABLE>";
echo '</div>';
}
示例2: history
/**
* show history of all the stock movement
* @param $p_array usually contains $_GET
*/
function history($p_array)
{
$sql = $this->create_query_histo($p_array);
require_once NOALYSS_INCLUDE . '/class_sort_table.php';
$p_url = HtmlInput::get_to_string(array("gDossier", "ac", "wcard", "wdate_start", "wdate_end", "wrepo", "wamount_start", "wamount_end", "wcode_stock", "wdirection"));
$tb = new Sort_Table();
$tb->add("Date", $p_url, " order by real_date asc", "order by real_date desc", "da", "dd");
$tb->add("Code Stock", $p_url, " order by sg_code asc", "order by sg_code desc", "sa", "sd");
$tb->add("Dépôt", $p_url, " order by r_name asc", "order by r_name desc", "ra", "rd");
$tb->add("Fiche", $p_url, " order by 2 asc", "order by 2 desc", "fa", "fd");
$tb->add("Commentaire", $p_url, " order by coalesce(sg_comment,jr_comment) asc", "order by coalesce(sg_comment,jr_comment) desc", "ca", "cd");
$tb->add("Montant", $p_url, " order by j_montant asc", "order by j_montant desc", "ja", "jd");
$tb->add("Quantité", $p_url, " order by sg_quantity asc", "order by sg_quantity desc", "qa", "qd");
$tb->add("IN/OUT", $p_url, " order by (case when sg_type='c' then 'OUT' when sg_type='c' then 'IN' end ) asc", "order by (case when sg_type='c' then 'OUT' when sg_type='c' then 'IN' end ) desc", "ta", "td");
$order = isset($p_array['ord']) ? $p_array['ord'] : 'da';
$sql .= $tb->get_sql_order($order);
$step = $_SESSION['g_pagesize'];
$page = isset($_GET['offset']) ? $_GET['page'] : 1;
$offset = isset($_GET['offset']) ? $_GET['offset'] : 0;
$res = $this->cn->exec_sql($sql);
$max_row = Database::num_row($res);
$nav_bar = navigation_bar($offset, $max_row, 0, $page);
if ($step != -1) {
$res = $this->cn->exec_sql($sql . " , sg_id asc limit " . $step . " offset " . $offset);
}
$max_row = Database::num_row($res);
$this->search_box_button();
$this->search_box($p_array);
require_once NOALYSS_INCLUDE . '/template/stock_histo.php';
$this->export_stock_histo_form();
echo HtmlInput::print_window();
}
示例3: load
function load()
{
$filter = $this->set_sql_filter();
// sum debit
$sql = "select m.po_id,sum(deb) as sum_deb,sum(cred) as sum_cred,";
$sql .= " po_name||' '||coalesce(po_description,'') as po_name";
$sql .= " from ";
$sql .= " (select po_id,case when oa_debit='t' then oa_amount else 0 end as deb,";
$sql .= "case when oa_debit='f' then oa_amount else 0 end as cred ";
$sql .= " from operation_analytique join poste_analytique using(po_id)";
$sql .= empty($filter) == false ? " where " . $filter : "";
$sql .= " ) as m join poste_analytique using (po_id)";
$sql .= " where pa_id=" . $this->pa_id;
$sql .= " group by po_id,po_name,po_description";
$sql .= " order by po_id";
$res = $this->db->exec_sql($sql);
if (Database::num_row($res) == 0) {
$this->has_data = 0;
return null;
}
$a = array();
$count = 0;
$array = Database::fetch_all($res);
foreach ($array as $row) {
$a[$count]['po_id'] = $row['po_id'];
$a[$count]['sum_deb'] = $row['sum_deb'];
$a[$count]['sum_cred'] = $row['sum_cred'];
$a[$count]['po_name'] = $row['po_name'];
$a[$count]['solde'] = abs($row['sum_deb'] - $row['sum_cred']);
$a[$count]['debit'] = $row['sum_deb'] > $row['sum_cred'] ? "debit" : "credit";
$count++;
}
$this->has_data = $count;
return $a;
}
示例4: search_by_jid
function search_by_jid($p_jid)
{
$res = $this->db->exec_sql("select qs_id from quant_sold where j_id=" . $p_jid);
if (Database::num_row($res) == 1) {
$this->qs_id = Database::fetch_result($res, 0, 0);
} else {
$this->qs_id = 0;
}
}
示例5: get_lib
function get_lib()
{
$ret = $this->db->exec_sql("select pcm_lib from tmp_pcmn where\n pcm_val=\$1", array($this->pcm_val));
if (Database::num_row($ret) != 0) {
$r = Database::fetch_array($ret);
$this->pcm_lib = $r['pcm_lib'];
} else {
$this->pcm_lib = _("Poste inconnu");
}
return $this->pcm_lib;
}
示例6: __construct
function __construct()
{
global $cn;
$menu = new Default_Menu_SQL($cn);
$ret = $menu->seek();
for ($i = 0; $i < Database::num_row($ret); $i++) {
$tmenu = $menu->next($ret, $i);
$idx = $tmenu->getp('md_code');
$this->a_menu_def[$idx] = $tmenu->getp('me_code');
}
$this->code = explode(',', 'code_follow,code_invoice');
}
示例7: Own
function Own($p_cn)
{
$this->db = $p_cn;
$Res = $p_cn->exec_sql("select * from parameter where pr_id like 'MY_%'");
for ($i = 0; $i < Database::num_row($Res); $i++) {
$row = Database::fetch_array($Res, $i);
$key = $row['pr_id'];
$elt = $row['pr_value'];
// store value here
$this->{"{$key}"} = $elt;
}
}
示例8: isValid_deprecrated
function isValid_deprecrated($p_cn, $p_grpt_id)
{
$Res = $p_cn->exec_sql("select jr_valid from jrn where jr_grpt_id={$p_grpt_id}");
if (($M = Database::num_row($Res)) == 0) {
return 0;
}
$a = Database::fetch_array($Res, 0);
if ($a['jr_valid'] == 't') {
return 1;
}
if ($a['jr_valid'] == 'f') {
return 0;
}
echo_error("Invalid result = " . $a['result']);
}
示例9: fetch_from_db
private function fetch_from_db($p_where)
{
$sql = "select po_id,\n po_name ,\n pa_id,\n po_amount,\n po_description,\n ga_id\n from poste_analytique\n where " . $p_where;
$ret = $this->db->exec_sql($sql);
if (Database::num_row($ret) == 0) {
return null;
}
$line = Database::fetch_array($ret);
$this->id = $line['po_id'];
$this->name = $line['po_name'];
$this->pa_id = $line['pa_id'];
$this->amount = $line['po_amount'];
$this->description = $line['po_description'];
$this->ga_id = $line['ga_id'];
}
示例10: sub_menu
/**
* Display the content of a profile menu for printing
* @param type $resource
* @param type $p_id
*/
function sub_menu($resource, $p_id)
{
if (Database::num_row($resource) != 0) {
////
// If there are submenus
$gDossier = dossier::id();
echo '<td>';
for ($e = 0; $e < Database::num_row($resource); $e++) {
$menu = Database::fetch_array($resource, $e);
$me_code = $menu['me_code'];
$me_code_dep = $menu['me_code_dep'];
$mp_type = $menu['p_type_display'];
$me_menu = $menu['me_menu'];
$me_desc = $menu['me_description'];
$me_def = $menu['pm_default'] == '1' ? '<span class="notice" style="display:inline">Défaut</span>' : '';
?>
<li id="sub<?php
echo $menu['pm_id'];
?>
">
<?php
echo $me_menu;
?>
<?php
echo $me_desc;
?>
<?php
echo $me_def;
?>
<?php
$ret2 = $this->cn->exec_sql("\n SELECT pm_id,\n pm.me_code,\n me_code_dep,\n p_id,\n p_order,\n p_type_display,\n pm_default,\n pm_desc,\n me_menu,\n me_description\n FROM profile_menu as pm\n join profile_menu_type on (p_type_display=pm_type)\n join menu_ref as mr on (mr.me_code=pm.me_code)\n where\n p_id=\$1 and me_code_dep=\$2\n order by p_order asc\n ", array($p_id, $me_code));
?>
<span>
<?php
echo HtmlInput::anchor(SMALLX, "", sprintf(" onclick = \"remove_sub_menu(%d,%d)\"", Dossier::id(), $menu['pm_id']), 'class="tinybutton"');
?>
</span>
<?php
echo "</li>";
}
//end loop e
echo '</ul>';
}
// end if
}
示例11: get_by_account
function get_by_account($p_poste = 0)
{
$this->poste = $p_poste == 0 ? $this->poste : $p_poste;
$sql = "select * from vw_supplier where poste_comptable=" . $this->poste;
$Res = $this->cn->exec_sql($sql);
if (Database::num_row($Res) == 0) {
return null;
}
// There is only _one_ row by supplier
$row = Database::fetch_array($Res, 0);
$this->name = $row['name'];
$this->id = $row['f_id'];
$this->street = $row['rue'];
$this->cp = $row['code_postal'];
$this->country = $row['pays'];
$this->vat_number = $row['tva_num'];
}
示例12: nb
$a = $line_tva['tva_id'];
if (isset($a_tva_amount[$a])) {
echo '<td class="num">' . nb($a_tva_amount[$a]) . '</td>';
$tot['tva'][$a] = isset($tot['tva'][$a]) ? bcadd($tot['tva'][$a], floatval($a_tva_amount[$a])) : floatval($a_tva_amount[$a]);
} else {
printf("<td class=\"num\"></td>");
}
}
}
echo '<td class="num">' . $line['TVAC'] . '</td>';
$tot['tvac'] = bcadd($tot['tvac'], floatval($line['TVAC']));
/*
* If reconcile print them
*/
echo '<td>';
$max = Database::num_row($ret_reconcile);
if ($max > 0) {
$sep = "";
for ($e = 0; $e < $max; $e++) {
$row = Database::fetch_array($ret_reconcile, $e);
echo $sep . HtmlInput::detail_op($row['jr_id'], $row['jr_date'] . ' ' . $row['jr_internal']);
$sep = ' ,';
}
}
echo '</td>';
echo "</tr>";
}
/**
* summary
*/
?>
示例13: get_jrid
function get_jrid()
{
$sql = "select distinct jr_id from jrn join jrnx on (j_grpt=jr_grpt_id) join operation_analytique using (j_id) where j_id is not null and oa_group=" . $this->oa_group;
$res = $this->db->exec_sql($sql);
if (Database::num_row($res) == 0) {
return 0;
}
$ret = Database::fetch_all($res);
return $ret[0]['jr_id'];
}
示例14: load
public function load()
{
$sql = "select tl_id,tl_title,tl_desc,to_char( tl_date,'DD.MM.YYYY') as tl_date,is_public,use_login\n from todo_list where tl_id=\$1 ";
$res = $this->cn->exec_sql($sql, array($this->tl_id));
if (Database::num_row($res) == 0) {
return;
}
$row = Database::fetch_array($res, 0);
foreach ($row as $idx => $value) {
$this->{$idx} = $value;
}
}
示例15: load
function load()
{
try {
if ($this->b_id == "") {
throw new Exception(_("le formulaire id n'est pas donnee"));
}
$sql = "select b_name,b_file_template,b_file_form,lower(b_type) as b_type from bilan where" . " b_id = " . $this->b_id;
$res = $this->db->exec_sql($sql);
if (Database::num_row($res) == 0) {
throw new Exception(_('Aucun enregistrement trouve'));
}
$array = Database::fetch_array($res, 0);
foreach ($array as $name => $value) {
$this->{$name} = $value;
}
} catch (Exception $Ex) {
echo $Ex->getMessage();
throw $Ex;
}
}