本文整理匯總了PHP中DB_num_rows函數的典型用法代碼示例。如果您正苦於以下問題:PHP DB_num_rows函數的具體用法?PHP DB_num_rows怎麽用?PHP DB_num_rows使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了DB_num_rows函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: GetReports
function GetReports($GroupID)
{
global $db, $rootpath;
$Title = array(_('Custom Reports'), _('Default Reports'));
$RptForm = '<form name="ReportList" method="post" action="' . $rootpath . '/reportwriter/ReportMaker.php?action=go">';
$RptForm .= '<table align="center" border="0" cellspacing="1" cellpadding="1" class="table_index">';
for ($Def = 1; $Def >= 0; $Def--) {
$RptForm .= '<tr><td colspan="2"><div align="center">' . $Title[$Def] . '</div></td></tr>';
$sql = "SELECT id, reportname FROM reports \n\t\t\tWHERE defaultreport='" . $Def . "' AND groupname='" . $GroupID . "' \n\t\t\tORDER BY reportname";
$Result = DB_query($sql, $db, '', '', false, true);
if (DB_num_rows($Result) > 0) {
$RptForm .= '<tr><td><select name="ReportID" size="10" onChange="submit()">';
while ($Temp = DB_fetch_array($Result)) {
$RptForm .= '<option value="' . $Temp['id'] . '">' . $Temp['reportname'] . '</option>';
}
$RptForm .= '</select></td></tr>';
} else {
$RptForm .= '<tr><td colspan="2">' . _('There are no reports to show!') . '</td></tr>';
}
}
$RptForm .= '</table></form>';
return $RptForm;
}
示例2: db
function db($user, $password)
{
$_SESSION['UserID'] = $user;
$sql = "SELECT userid,\n\t\t\t\t\t\taccesslevel\n\t\t\t\tFROM www_users\n\t\t\t\tWHERE userid='" . DB_escape_string($user) . "'\n\t\t\t\tAND (password='" . CryptPass(DB_escape_string($password)) . "'\n\t\t\t\tOR password='" . DB_escape_string($password) . "')";
$Auth_Result = DB_query($sql, $_SESSION['db']);
$myrow = DB_fetch_row($Auth_Result);
if (DB_num_rows($Auth_Result) > 0) {
$sql = 'SELECT tokenid FROM securitygroups
WHERE secroleid = ' . $_SESSION['AccessLevel'];
$Sec_Result = DB_query($sql, $db);
$_SESSION['AllowedPageSecurityTokens'] = array();
if (DB_num_rows($Sec_Result) == 0) {
return NoAuthorisation;
} else {
$i = 0;
while ($myrow = DB_fetch_row($Sec_Result)) {
$_SESSION['AllowedPageSecurityTokens'][$i] = $myrow[0];
$i++;
}
}
return $_SESSION['db'];
} else {
return NoAuthorisation;
}
}
示例3: checkSupplierExist
function checkSupplierExist($codeSupplier)
{
global $db;
$result = DB_query("SELECT supplierid FROM suppliers WHERE supplierid='" . $codeSupplier . "'", $db);
if (DB_num_rows($result) == 0) {
return false;
}
return true;
}
示例4: backup_tables
function backup_tables($host, $user, $pass, $tables = '*', $db)
{
//get all of the tables
if ($tables == '*') {
$tables = array();
$result = DB_query('SHOW TABLES', $db);
while ($row = DB_fetch_row($result)) {
$tables[] = $row[0];
}
} else {
$tables = is_array($tables) ? $tables : explode(',', $tables);
}
//cycle through
foreach ($tables as $table) {
$result = DB_query('SELECT * FROM ' . $table, $db);
$num_fields = DB_num_fields($result);
$num_rows = DB_num_rows($result);
$return .= 'DROP TABLE IF EXISTS ' . $table . ';';
$row2 = DB_fetch_row(DB_query('SHOW CREATE TABLE ' . $table, $db));
$return .= "\n\n" . $row2[1] . ";\n\n";
$return .= 'INSERT INTO ' . $table . ' VALUES';
for ($i = 0; $i < $num_fields; $i++) {
$last = 0;
while ($row = DB_fetch_row($result)) {
$last = $last + 1;
$return .= '(';
for ($j = 0; $j < $num_fields; $j++) {
$row[$j] = addslashes($row[$j]);
$row[$j] = ereg_replace("\n", "\\n", $row[$j]);
if (isset($row[$j])) {
$return .= '"' . $row[$j] . '"';
} else {
$return .= '""';
}
if ($j < $num_fields - 1 and isset($row[$j])) {
$return .= ',';
}
}
if ($last == $num_rows) {
$return .= ");\n";
} else {
$return .= "),";
}
}
}
$return .= "\n\n\n";
}
//save file
$handle = fopen('db-backup-' . time() . '-' . md5(implode(',', $tables)) . '.sql', 'w+');
fwrite($handle, $return);
fclose($handle);
prnMsg(_(' back up successful'), 'success');
}
示例5: GetExpiryDate
function GetExpiryDate($StockID, $LocCode, $BundleRef)
{
global $db;
$SQL = "SELECT expirationdate \n\t\t\t\tFROM stockserialitems\n\t\t\t\tWHERE stockid = '" . $StockID . "'\n\t\t\t\tAND loccode = '" . $LocCode . "'\n\t\t\t\tAND serialno = '" . $BundleRef . "'";
$Result = DB_query($SQL);
if (DB_num_rows($Result) == 0) {
return '0000-00-00';
} else {
$myrow = DB_fetch_row($Result);
return ConvertSQLDate($myrow[0]);
}
}
示例6: db
function db($user, $password)
{
$_SESSION['UserID'] = $user;
$sql = "SELECT userid\n\t\t\tFROM www_users\n\t\t\tWHERE userid='" . DB_escape_string($user) . "'\n\t\t\tAND (password='" . CryptPass(DB_escape_string($password)) . "'\n\t\t\tOR password='" . DB_escape_string($password) . "')";
$Auth_Result = DB_query($sql, $_SESSION['db']);
$myrow = DB_fetch_row($Auth_Result);
if (DB_num_rows($Auth_Result) > 0) {
return $_SESSION['db'];
} else {
return NoAuthorisation;
}
}
示例7: ValidBundleRef
function ValidBundleRef($StockID, $LocCode, $BundleRef)
{
global $db;
$SQL = "SELECT quantity\n\t\t\t\tFROM stockserialitems\n\t\t\t\tWHERE stockid='" . $StockID . "'\n\t\t\t\tAND loccode ='" . $LocCode . "'\n\t\t\t\tAND serialno='" . $BundleRef . "'";
$Result = DB_query($SQL, $db);
if (DB_num_rows($Result) == 0) {
return 0;
} else {
$myrow = DB_fetch_row($Result);
return $myrow[0];
/*The quantity in the bundle */
}
}
示例8: Receipt
function Receipt($Amt, $Cust, $Disc, $Narr, $id, $GLCode, $PayeeBankDetail, $CustomerName, $Tag)
{
global $db;
/* Constructor function to add a new Receipt object with passed params */
$this->Amount = $Amt;
$this->Customer = $Cust;
$this->CustomerName = $CustomerName;
$this->Discount = $Disc;
$this->Narrative = $Narr;
$this->GLCode = $GLCode;
$this->PayeeBankDetail = $PayeeBankDetail;
$this->ID = $id;
$this->tag = $Tag;
$result = DB_query("SELECT tagdescription FROM tags WHERE tagref='" . $Tag . "'");
if (DB_num_rows($result) == 1) {
$TagRow = DB_fetch_array($result);
$this->TagName = $TagRow['tagdescription'];
}
}
示例9: GetRptLinks
function GetRptLinks($GroupID)
{
global $db, $RootPath;
$Title = array(_('Custom Reports'), _('Standard Reports'));
$RptLinks = '';
for ($Def = 1; $Def >= 0; $Def--) {
$RptLinks .= '<tr><td class="menu_group_headers"><div align="center">' . $Title[$Def] . '</div></td></tr>';
$sql = "SELECT id, reportname FROM reports\n\t\t\tWHERE defaultreport='" . $Def . "' AND groupname='" . $GroupID . "'\n\t\t\tORDER BY reportname";
$Result = DB_query($sql, $db, '', '', false, true);
if (DB_num_rows($Result) > 0) {
while ($Temp = DB_fetch_array($Result)) {
$RptLinks .= '<tr><td class="menu_group_item">';
$RptLinks .= '<a href="' . $RootPath . '/reportwriter/ReportMaker.php?action=go&reportid=' . $Temp['id'] . '"><li>' . _($Temp['reportname']) . '</li></a>';
$RptLinks .= '</td></tr>';
}
} else {
$RptLinks .= '<tr><td class="menu_group_item">' . _('There are no reports to show!') . '</td></tr>';
}
}
return $RptLinks;
}
示例10: CheckForRecursiveBOM
function CheckForRecursiveBOM($UltimateParent, $ComponentToCheck, $db)
{
/* returns true ie 1 if the BOM contains the parent part as a component
ie the BOM is recursive otherwise false ie 0 */
$sql = "SELECT component FROM bom WHERE parent='" . $ComponentToCheck . "'";
$ErrMsg = _('An error occurred in retrieving the components of the BOM during the check for recursion');
$DbgMsg = _('The SQL that was used to retrieve the components of the BOM and that failed in the process was');
$result = DB_query($sql, $db, $ErrMsg, $DbgMsg);
if (DB_num_rows($result) != 0) {
while ($myrow = DB_fetch_array($result)) {
if ($myrow['component'] == $UltimateParent) {
return 1;
}
if (CheckForRecursiveBOM($UltimateParent, $myrow['component'], $db)) {
return 1;
}
}
//(while loop)
}
//end if $result is true
return 0;
}
示例11: locale_number_format
<td><input type="text" class="number" name="Pansize" size="6" maxlength="6" value="' . locale_number_format($_POST['Pansize'], 0) . '" /></td>
</tr>
<tr>
<td>' . _('Shrinkage Factor') . ':</td>
<td><input type="text" class="number" name="ShrinkFactor" size="6" maxlength="6" value="' . locale_number_format($_POST['ShrinkFactor'], 0) . '" /></td>
</tr>';
echo '</table>
<div class="centre">';
if (!isset($_POST['CategoryID'])) {
$_POST['CategoryID'] = '';
}
$sql = "SELECT stkcatpropid,\n label,\n controltype,\n defaultvalue,\n numericvalue,\n minimumvalue,\n maximumvalue\n FROM stockcatproperties\n WHERE categoryid ='" . $_POST['CategoryID'] . "'\n AND reqatsalesorder =0\n ORDER BY stkcatpropid";
$PropertiesResult = DB_query($sql, $db);
$PropertyCounter = 0;
$PropertyWidth = array();
if (DB_num_rows($PropertiesResult) > 0) {
echo '<br />
<table class="selection">';
echo '<tr>
<th colspan="2">' . _('Item Category Properties') . '</th>
</tr>';
while ($PropertyRow = DB_fetch_array($PropertiesResult)) {
if (isset($_POST['StockID']) && !empty($_POST['StockID'])) {
$PropValResult = DB_query("SELECT value FROM\n stockitemproperties\n WHERE stockid='" . $_POST['StockID'] . "'\n AND stkcatpropid ='" . $PropertyRow['stkcatpropid'] . "'", $db);
$PropValRow = DB_fetch_row($PropValResult);
$PropertyValue = $PropValRow[0];
} else {
$PropertyValue = '';
}
echo '<tr>
<td>';
示例12: _
<?php
/* $Id$*/
/**
If the User has selected Keyed Entry, show them this special select list...
it is just in the way if they are doing file imports
it also would not be applicable in a PO and possible other situations...
**/
if ($_POST['EntryType'] == 'KEYED') {
/*Also a multi select box for adding bundles to the dispatch without keying */
$sql = "SELECT serialno, quantity\n\t\t\tFROM stockserialitems\n\t\t\tWHERE stockid='" . $StockID . "' \n\t\t\tAND loccode ='" . $LocationOut . "' \n\t\t\tAND quantity > 0";
$ErrMsg = '<br />' . _('Could not retrieve the items for') . ' ' . $StockID;
$Bundles = DB_query($sql, $db, $ErrMsg);
echo '<table class="selection"><tr>';
if (DB_num_rows($Bundles) > 0) {
$AllSerials = array();
foreach ($LineItem->SerialItems as $Itm) {
$AllSerials[$Itm->BundleRef] = $Itm->BundleQty;
}
echo '<td valign="top"><b>' . _('Select Existing Items') . '</b><br />';
echo '<form action="' . htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES, 'UTF-8') . '?identifier=' . $identifier . '" method="post">';
echo '<input type="hidden" name="FormID" value="' . $_SESSION['FormID'] . '" />';
echo '<input type="hidden" name="LineNo" value="' . $LineNo . '">
<input type="hidden" name="StockID" value="' . $StockID . '">
<input type="hidden" name="EntryType" value="KEYED">
<input type="hidden" name="identifier" value="' . $identifier . '">
<input type="hidden" name="EditControlled" value="true">
<select name=Bundles[] multiple="multiple">';
$id = 0;
$ItemsAvailable = 0;
while ($myrow = DB_fetch_array($Bundles, $db)) {
示例13: TO_DAYS
locations
WHERE recurringsalesorders.ordertype=salestypes.typeabbrev
AND recurringsalesorders.debtorno = debtorsmaster.debtorno
AND recurringsalesorders.debtorno = custbranch.debtorno
AND recurringsalesorders.branchcode = custbranch.branchcode
AND recurringsalesorders.fromstkloc=locations.loccode
AND recurringsalesorders.ordertype=salestypes.typeabbrev
AND (TO_DAYS(NOW()) - TO_DAYS(recurringsalesorders.lastrecurrence)) > (365/recurringsalesorders.frequency)
AND DATE_ADD(recurringsalesorders.lastrecurrence, ' . INTERVAL('365/recurringsalesorders.frequency', 'DAY') . ') <= recurringsalesorders.stopdate';
$RecurrOrdersDueResult = DB_query($sql, $db, _('There was a problem retrieving the recurring sales order templates. The database reported:'));
if (DB_num_rows($RecurrOrdersDueResult) == 0) {
prnMsg(_('There are no recurring order templates that are due to have another recurring order created'), 'warn');
include 'includes/footer.inc';
exit;
}
echo '<BR>The number of recurring orders to process is : ' . DB_num_rows($RecurrOrdersDueResult);
while ($RecurrOrderRow = DB_fetch_array($RecurrOrdersDueResult)) {
$EmailText = '';
echo '<BR>' . _('Recurring order') . ' ' . $RecurrOrderRow['recurrorderno'] . ' ' . _('for') . ' ' . $RecurrOrderRow['debtorno'] . ' - ' . $RecurrOrderRow['branchcode'] . ' ' . _('is being processed');
$result = DB_Txn_Begin($db);
/*the last recurrence was the date of the last time the order recurred
the frequency is the number of times per annum that the order should recurr
so 365 / frequency gives the number of days between recurrences */
$DelDate = FormatDateforSQL(DateAdd(ConvertSQLDate($RecurrOrderRow['lastrecurrence']), 'd', 365 / $RecurrOrderRow['frequency']));
echo '<BR>Date calculated for the next recurrence was: ' . $DelDate;
$HeaderSQL = "INSERT INTO salesorders (\n\t\t\t\tdebtorno,\n\t\t\t\tbranchcode,\n\t\t\t\tcustomerref,\n\t\t\t\tcomments,\n\t\t\t\torddate,\n\t\t\t\tordertype,\n\t\t\t\tshipvia,\n\t\t\t\tdeliverto,\n\t\t\t\tdeladd1,\n\t\t\t\tdeladd2,\n\t\t\t\tdeladd3,\n\t\t\t\tdeladd4,\n\t\t\t\tdeladd5,\n\t\t\t\tdeladd6,\n\t\t\t\tcontactphone,\n\t\t\t\tcontactemail,\n\t\t\t\tfreightcost,\n\t\t\t\tfromstkloc,\n\t\t\t\tdeliverydate )\n\t\t\tVALUES (\n\t\t\t\t'" . $RecurrOrderRow['debtorno'] . "',\n\t\t\t\t'" . $RecurrOrderRow['branchcode'] . "',\n\t\t\t\t'" . $RecurrOrderRow['customerref'] . "',\n\t\t\t\t'" . $RecurrOrderRow['comments'] . "',\n\t\t\t\t'" . $DelDate . "',\n\t\t\t\t'" . $RecurrOrderRow['ordertype'] . "',\n\t\t\t\t" . $RecurrOrderRow['shipvia'] . ",\n\t\t\t\t'" . $RecurrOrderRow['deliverto'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd1'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd2'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd3'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd4'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd5'] . "',\n\t\t\t\t'" . $RecurrOrderRow['deladd6'] . "',\n\t\t\t\t'" . $RecurrOrderRow['contactphone'] . "',\n\t\t\t\t'" . $RecurrOrderRow['contactemail'] . "',\n\t\t\t\t" . $RecurrOrderRow['freightcost'] . ",\n\t\t\t\t'" . $RecurrOrderRow['fromstkloc'] . "',\n\t\t\t\t'" . $DelDate . "')";
$ErrMsg = _('The order cannot be added because');
$InsertQryResult = DB_query($HeaderSQL, $db, $ErrMsg, true);
$OrderNo = GetNextTransNo(30, $db);
$EmailText = _('A new order has been created from a recurring order template for customer') . ' ' . $RecurrOrderRow['debtorno'] . ' ' . $RecurrOrderRow['branchcode'] . "\n" . _('The order number is:') . ' ' . $OrderNo;
/*need to look up RecurringOrder from the template and populate the line RecurringOrder array with the sales order details records */
示例14: SUM
// Javier: I added this must be called before Add Page
$pdf->AddPage();
// $this->SetLineWidth(1); Javier: It was ok for FPDF but now is too gross with TCPDF. TCPDF defaults to 0'57 pt (0'2 mm) which is ok.
$pdf->cMargin = 0;
// Javier: needs check.
/* END Brought from class.pdf.php constructor */
$PageNumber = 1;
$line_height = 12;
/*Now figure out the inventory data to report for the category range under review */
if ($Location == 'All') {
$SQL = "SELECT stockmaster.categoryid,\n\t\t\tstockcategory.categorydescription,\n\t\t\tstockmaster.stockid,\n\t\t\tstockmaster.description,\n\t\t\tstockmaster.decimalplaces,\n\t\t\tSUM(locstock.quantity) as qtyonhand,\n\t\t\tstockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost AS unitcost,\n\t\t\tSUM(locstock.quantity) *(stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) AS itemtotal\n\t\tFROM stockmaster,\n\t\t\tstockcategory,\n\t\t\tlocstock\n\t\tWHERE stockmaster.stockid=locstock.stockid\n\t\tAND stockmaster.categoryid=stockcategory.categoryid\n\t\tGROUP BY stockmaster.categoryid,\n\t\t\tstockcategory.categorydescription,\n\t\t\tunitcost,\n\t\t\tstockmaster.stockid,\n\t\t\tstockmaster.description\n\t\tHAVING SUM(locstock.quantity)!=0\n\t\tAND stockmaster.categoryid >= '" . $FromCriteria . "'\n\t\tAND stockmaster.categoryid <= '" . $ToCriteria . "'\n\t\tORDER BY stockmaster.categoryid,\n\t\t\tstockmaster.stockid";
} else {
$SQL = "SELECT stockmaster.categoryid,\n\t\t\tstockcategory.categorydescription,\n\t\t\tstockmaster.stockid,\n\t\t\tstockmaster.description,\n\t\t\tstockmaster.decimalplaces,\n\t\t\tlocstock.quantity as qtyonhand,\n\t\t\tstockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost AS unitcost,\n\t\t\tlocstock.quantity *(stockmaster.materialcost + stockmaster.labourcost + stockmaster.overheadcost) AS itemtotal\n\t\tFROM stockmaster,\n\t\t\tstockcategory,\n\t\t\tlocstock\n\t\tWHERE stockmaster.stockid=locstock.stockid\n\t\tAND stockmaster.categoryid=stockcategory.categoryid\n\t\tAND locstock.quantity!=0\n\t\tAND stockmaster.categoryid >= '" . $FromCriteria . "'\n\t\tAND stockmaster.categoryid <= '" . $ToCriteria . "'\n\t\tAND locstock.loccode = '" . $Location . "'\n\t\tORDER BY stockmaster.categoryid,\n\t\t\tstockmaster.stockid";
}
$InventoryResult = DB_query($SQL, $db, '', '', false, true);
$ListCount = DB_num_rows($InventoryResult);
if (DB_error_no($db) != 0) {
$title = _('Inventory Valuation') . ' - ' . _('Problem Report');
include 'includes/header.inc';
echo _('The inventory valuation could not be retrieved by the SQL because') . ' - ' . DB_error_msg($db);
echo '<br /><a href="' . $rootpath . '/index.php">' . _('Back to the menu') . '</a>';
if ($debug == 1) {
echo '<br />' . $SQL;
}
include 'includes/footer.inc';
exit;
}
include 'includes/PDFInventoryValnPageHeader.inc';
$Tot_Val = 0;
$Category = '';
$CatTot_Val = 0;
示例15: DB_fetch_array
$AccumProfitRow = DB_fetch_array($AccumProfitResult);
/*should only be one row returned */
$SQL = "SELECT accountgroups.sectioninaccounts,\n\t\t\taccountgroups.groupname,\n\t\t\taccountgroups.parentgroupname,\n\t\t\tchartdetails.accountcode ,\n\t\t\tchartmaster.accountname,\n\t\t\tSum(CASE WHEN chartdetails.period='" . $_POST['BalancePeriodEnd'] . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS balancecfwd,\n\t\t\tSum(CASE WHEN chartdetails.period='" . ($_POST['BalancePeriodEnd'] - 12) . "' THEN chartdetails.bfwd + chartdetails.actual ELSE 0 END) AS lybalancecfwd\n\t\tFROM chartmaster INNER JOIN accountgroups\n\t\tON chartmaster.group_ = accountgroups.groupname INNER JOIN chartdetails\n\t\tON chartmaster.accountcode= chartdetails.accountcode\n\t\tWHERE accountgroups.pandl=0\n\t\tGROUP BY accountgroups.groupname,\n\t\t\tchartdetails.accountcode,\n\t\t\tchartmaster.accountname,\n\t\t\taccountgroups.parentgroupname,\n\t\t\taccountgroups.sequenceintb,\n\t\t\taccountgroups.sectioninaccounts\n\t\tORDER BY accountgroups.sectioninaccounts,\n\t\t\taccountgroups.sequenceintb,\n\t\t\taccountgroups.groupname,\n\t\t\tchartdetails.accountcode";
$AccountsResult = DB_query($SQL, $db);
if (DB_error_no($db) != 0) {
$Title = _('Balance Sheet') . ' - ' . _('Problem Report') . '....';
include 'includes/header.inc';
prnMsg(_('No general ledger accounts were returned by the SQL because') . ' - ' . DB_error_msg($db));
echo '<br /><a href="' . $RootPath . '/index.php">' . _('Back to the menu') . '</a>';
if ($debug == 1) {
echo '<br />' . $SQL;
}
include 'includes/footer.inc';
exit;
}
$ListCount = DB_num_rows($AccountsResult);
// UldisN
include 'includes/PDFBalanceSheetPageHeader.inc';
$k = 0;
//row colour counter
$Section = '';
$SectionBalance = 0;
$SectionBalanceLY = 0;
$LYCheckTotal = 0;
$CheckTotal = 0;
$ActGrp = '';
$Level = 0;
$ParentGroups = array();
$ParentGroups[$Level] = '';
$GroupTotal = array(0);
$LYGroupTotal = array(0);