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


PHP sql_query::num_rows方法代码示例

本文整理汇总了PHP中sql_query::num_rows方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_query::num_rows方法的具体用法?PHP sql_query::num_rows怎么用?PHP sql_query::num_rows使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sql_query的用法示例。


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

示例1: service

 function check_requirements()
 {
     // verify that the service exists
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id, id_rate_table FROM services WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     if ($sql_obj->num_rows()) {
         $sql_obj->fetch_array();
         // verify the rate is valid
         if ($sql_obj->data[0]["id_rate_table"]) {
             $this->obj_cdr_rate_table->id = $sql_obj->data[0]["id_rate_table"];
             if (!$this->obj_cdr_rate_table->verify_id()) {
                 log_write("error", "page_output", "The requested CDR rate table is invalid, there may be some problems with the information in the database.");
                 return 0;
             }
         } else {
             log_write("error", "page_output", "You have yet to set a CDR Rate Table for this service to use - please do so using the plan page before attempting to override the rates");
             return 0;
         }
     } else {
         log_write("error", "page_output", "The requested service (" . $this->id . ") does not exist - possibly the service has been deleted.");
         return 0;
     }
     unset($sql_obj);
     // verify that this is a phone service
     if ($this->service_type != ("phone_single" || "phone_trunk" || "phone_tollfree")) {
         log_write("error", "page_output", "The requested service is not a phone service.");
         return 0;
     }
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:31,代码来源:cdr-override.php

示例2: invoice

 function check_requirements()
 {
     // verify that the invoice exists
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id FROM account_ar WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     if (!$sql_obj->num_rows()) {
         log_write("error", "page_output", "The requested invoice (" . $this->id . ") does not exist - possibly the invoice has been deleted.");
         return 0;
     }
     unset($sql_obj);
     // verify that the item id supplied exists and fetch required information
     if ($this->itemid) {
         $sql_obj = new sql_query();
         $sql_obj->string = "SELECT id, type FROM account_items WHERE id='" . $this->itemid . "' AND invoiceid='" . $this->id . "' LIMIT 1";
         $sql_obj->execute();
         if (!$sql_obj->num_rows()) {
             log_write("error", "page_output", "The requested payment/invoice combination does not exist. Are you trying to use a link to a deleted payment?");
             return 0;
         } else {
             $sql_obj->fetch_array();
             $this->item_type = $sql_obj->data[0]["type"];
         }
     }
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:26,代码来源:invoice-payments-edit.php

示例3: project

 function check_requirements()
 {
     // verify that project exists
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id FROM projects WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     if (!$sql_obj->num_rows()) {
         log_write("error", "page_output", "The requested project (" . $this->id . ") does not exist - possibly the project has been deleted.");
         return 0;
     }
     unset($sql_obj);
     // verify that the time group exists and belongs to this project
     if ($this->groupid) {
         $sql_obj = new sql_query();
         $sql_obj->string = "SELECT projectid, locked FROM time_groups WHERE id='" . $this->groupid . "' LIMIT 1";
         $sql_obj->execute();
         if (!$sql_obj->num_rows()) {
             log_write("error", "page_output", "The requested time group (" . $this->groupid . ") does not exist - possibly the time group has been deleted.");
             return 0;
         } else {
             $sql_obj->fetch_array();
             $this->locked = $sql_obj->data[0]["locked"];
             if ($sql_obj->data[0]["projectid"] != $this->id) {
                 log_write("error", "page_output", "The requested time group (" . $this->groupid . ") does not belong to the selected project (" . $this->id . ")");
                 return 0;
             }
         }
         unset($sql_obj);
     }
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:31,代码来源:timebilled-delete.php

示例4: time

 function load_data()
 {
     log_debug("name_server", "Executing load_data()");
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT * FROM name_servers WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     if ($sql_obj->num_rows()) {
         $sql_obj->fetch_array();
         // set attributes
         $this->data = $sql_obj->data[0];
         // fetch sync statuses
         if ($this->data["server_type"] == "api") {
             if (sql_get_singlevalue("SELECT value FROM config WHERE name='SYNC_STATUS_CONFIG'") != $sql_obj->data[0]["api_sync_config"]) {
                 // out of sync, set to date
                 $this->data["sync_status_config"] = $sql_obj->data[0]["api_sync_config"];
             }
             if (time() - $sql_obj->data[0]["api_sync_log"] > 86400) {
                 // logging hasn't happened for at least 24 hours, flag logging as failed
                 $this->data["sync_status_log"] = $sql_obj->data[0]["api_sync_log"];
             }
         } else {
             $this->data["sync_status_config"] = time();
             $this->data["sync_status_log"] = time();
         }
         return 1;
     }
     // failure
     return 0;
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:29,代码来源:inc_servers.php

示例5: execute

 function execute()
 {
     /*
     	Define form structure
     */
     $this->obj_form = new form_input();
     $this->obj_form->formname = "users_permissions_staff";
     $this->obj_form->language = $_SESSION["user"]["lang"];
     $this->obj_form->action = "user/user-staffaccess-edit-process.php";
     $this->obj_form->method = "post";
     // run through all the avaliable permissions
     $sql_perms_obj = new sql_query();
     $sql_perms_obj->string = "SELECT * FROM `permissions_staff`";
     $sql_perms_obj->execute();
     if ($sql_perms_obj->num_rows()) {
         $sql_perms_obj->fetch_array();
         foreach ($sql_perms_obj->data as $data_perms) {
             // define the checkbox
             $structure = NULL;
             $structure["fieldname"] = $data_perms["value"];
             $structure["type"] = "checkbox";
             $structure["options"]["label"] = $data_perms["description"];
             // check the database to see if this checkbox is selected
             $sql_obj = new sql_query();
             $sql_obj->string = "SELECT " . "id " . "FROM `users_permissions_staff` " . "WHERE " . "userid='" . $this->id . "' " . "AND permid='" . $data_perms["id"] . "' " . "AND staffid='" . $this->staffid . "'";
             $sql_obj->execute();
             if ($sql_obj->num_rows()) {
                 $structure["defaultvalue"] = "on";
             }
             // add checkbox
             $this->obj_form->add_input($structure);
             // add checkbox to subforms
             $this->obj_form->subforms["user_permissions_staff"][] = $data_perms["value"];
         }
     }
     // hidden fields
     $structure = NULL;
     $structure["fieldname"] = "id_user";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $this->id;
     $this->obj_form->add_input($structure);
     $structure = NULL;
     $structure["fieldname"] = "id_staff";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $this->staffid;
     $this->obj_form->add_input($structure);
     // submit section
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Save Changes";
     $this->obj_form->add_input($structure);
     // define subforms
     $this->obj_form->subforms["hidden"] = array("id_user", "id_staff");
     $this->obj_form->subforms["submit"] = array("submit");
     /*
     	Note: We don't load from error data, since there should never
     	be any errors when using this form.
     */
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:60,代码来源:user-staffaccess-edit.php

示例6: foreach

 function list_taxes()
 {
     log_debug("accounts_taxes_manage_soap", "Executing list_taxes()");
     if (user_permissions_get("accounts_taxes_view")) {
         // fetch taxes
         $sql_obj = new sql_query();
         $sql_obj->string = "SELECT id, name_tax, taxrate, chartid, taxnumber, description FROM account_taxes";
         $sql_obj->execute();
         $return = NULL;
         if ($sql_obj->num_rows()) {
             $sql_obj->fetch_array();
             // package data into array for passing back to SOAP client
             foreach ($sql_obj->data as $data) {
                 $return_tmp = NULL;
                 $return_tmp["id"] = $data["id"];
                 $return_tmp["name_tax"] = $data["name_tax"];
                 $return_tmp["taxrate"] = $data["taxrate"];
                 $return_tmp["chartid"] = $data["chartid"];
                 $return_tmp["chartid_label"] = sql_get_singlevalue("SELECT CONCAT_WS('--', code_chart, description) as value FROM account_charts WHERE id='" . $data["chartid"] . "'");
                 $return_tmp["taxnumber"] = $data["taxnumber"];
                 $return_tmp["description"] = $data["description"];
                 $return[] = $return_tmp;
             }
         }
         return $return;
     } else {
         throw new SoapFault("Sender", "ACCESS_DENIED");
     }
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:29,代码来源:taxes_manage.php

示例7: quotes_render_summarybox

function quotes_render_summarybox($id)
{
    log_debug("inc_quotes", "quotes_render_summarybox({$id})");
    // fetch quote information
    $sql_obj = new sql_query();
    $sql_obj->string = "SELECT code_quote, amount_total, date_validtill, date_sent, sentmethod FROM account_quotes WHERE id='{$id}' LIMIT 1";
    $sql_obj->execute();
    if ($sql_obj->num_rows()) {
        $sql_obj->fetch_array();
        if ($sql_obj->data[0]["amount_total"] == 0) {
            print "<table width=\"100%\" class=\"table_highlight_important\">";
            print "<tr>";
            print "<td>";
            print "<b>Quote " . $sql_obj->data[0]["code_quote"] . " has no items on it</b>";
            print "<p>This quote needs to have some items added to it using the links in the nav menu above.</p>";
            print "</td>";
            print "</tr>";
            print "</table>";
        } else {
            if (time_date_to_timestamp($sql_obj->data[0]["date_validtill"]) <= time()) {
                print "<table width=\"100%\" class=\"table_highlight_important\">";
                print "<tr>";
                print "<td>";
                print "<p><b>Quote " . $sql_obj->data[0]["code_quote"] . " has now expired and is no longer valid.</b></p>";
                print "</td>";
                print "</tr>";
                print "</table>";
            } else {
                print "<table width=\"100%\" class=\"table_highlight_important\">";
                print "<tr>";
                print "<td>";
                print "<b>Quote " . $sql_obj->data[0]["code_quote"] . " is currently valid.</b>";
                print "<table cellpadding=\"4\">";
                print "<tr>";
                print "<td>Quote Total:</td>";
                print "<td>" . format_money($sql_obj->data[0]["amount_total"]) . "</td>";
                print "</tr>";
                print "<tr>";
                print "<td>Valid Until:</td>";
                print "<td>" . $sql_obj->data[0]["date_validtill"] . "</td>";
                print "</tr>";
                print "<tr>";
                print "<td>Date Sent:</td>";
                if ($sql_obj->data[0]["sentmethod"] == "") {
                    print "<td><i>Has not been sent to customer</i></td>";
                } else {
                    print "<td>" . $sql_obj->data[0]["date_sent"] . " (" . $sql_obj->data[0]["sentmethod"] . ")</td>";
                }
                print "</tr>";
                print "</tr></table>";
                print "</td>";
                print "</tr>";
                print "</table>";
            }
        }
        print "<br>";
    }
}
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:58,代码来源:inc_quotes.php

示例8: execute

 function execute()
 {
     /*
     	Define form structure
     */
     $this->obj_form = new form_input();
     $this->obj_form->formname = "users_permissions_staff";
     $this->obj_form->language = $_SESSION["user"]["lang"];
     $this->obj_form->action = "user/user-staffaccess-edit-process.php";
     $this->obj_form->method = "post";
     // staff member dropdown
     $structure = form_helper_prepare_dropdownfromdb("id_staff", "SELECT id, staff_code as label, name_staff as label1 FROM `staff` ORDER BY name_staff");
     $this->obj_form->add_input($structure);
     $this->obj_form->subforms["user_permissions_selectstaff"] = array("id_staff");
     /*
     	Permissions sub-form
     */
     // run through all the avaliable permissions
     $sql_perms_obj = new sql_query();
     $sql_perms_obj->string = "SELECT * FROM `permissions_staff`";
     $sql_perms_obj->execute();
     if ($sql_perms_obj->num_rows()) {
         $sql_perms_obj->fetch_array();
         foreach ($sql_perms_obj->data as $data_perms) {
             // define the checkbox
             $structure = NULL;
             $structure["fieldname"] = $data_perms["value"];
             $structure["type"] = "checkbox";
             $structure["options"]["label"] = $data_perms["description"];
             // add checkbox
             $this->obj_form->add_input($structure);
             // add checkbox to subforms
             $this->obj_form->subforms["user_permissions_staff"][] = $data_perms["value"];
         }
     }
     // hidden fields
     $structure = NULL;
     $structure["fieldname"] = "id_user";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $this->id;
     $this->obj_form->add_input($structure);
     // submit section
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Save Changes";
     $this->obj_form->add_input($structure);
     // define subforms
     $this->obj_form->subforms["hidden"] = array("id_user");
     $this->obj_form->subforms["submit"] = array("submit");
     /*
     	Note: We don't load from error data, since there should never
     	be any errors when using this form.
     */
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:55,代码来源:user-staffaccess-add.php

示例9: execute

 function execute()
 {
     /*
     	Define form structure
     */
     $this->obj_form = new form_input();
     $this->obj_form->formname = "user_permissions";
     $this->obj_form->language = $_SESSION["user"]["lang"];
     $this->obj_form->action = "user/user-permissions-process.php";
     $this->obj_form->method = "post";
     $sql_perms_obj = new sql_query();
     $sql_perms_obj->string = "SELECT * FROM `permissions` ORDER BY value='disabled' DESC, value='admin' DESC, value";
     $sql_perms_obj->execute();
     $sql_perms_obj->fetch_array();
     foreach ($sql_perms_obj->data as $data_perms) {
         // define the checkbox
         $structure = NULL;
         $structure["fieldname"] = $data_perms["value"];
         $structure["type"] = "checkbox";
         $structure["options"]["label"] = $data_perms["description"];
         $structure["options"]["no_translate_fieldname"] = "yes";
         // check if the user has this permission
         $sql_obj = new sql_query();
         $sql_obj->string = "SELECT id FROM `users_permissions` WHERE userid='" . $this->id . "' AND permid='" . $data_perms["id"] . "'";
         $sql_obj->execute();
         if ($sql_obj->num_rows()) {
             $structure["defaultvalue"] = "on";
         }
         // add checkbox
         $this->obj_form->add_input($structure);
         // add checkbox to subforms
         $this->obj_form->subforms["user_permissions"][] = $data_perms["value"];
     }
     // user ID (hidden field)
     $structure = NULL;
     $structure["fieldname"] = "id_user";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $this->id;
     $this->obj_form->add_input($structure);
     // submit section
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "Save Changes";
     $this->obj_form->add_input($structure);
     // define subforms
     $this->obj_form->subforms["hidden"] = array("id_user");
     $this->obj_form->subforms["submit"] = array("submit");
     /*
     	Note: We don't load from error data, since there should never
     	be any errors when using this form.
     */
 }
开发者ID:claybbs,项目名称:namedmanager,代码行数:53,代码来源:user-permissions.php

示例10: execute

 function execute()
 {
     // make sure tax does not belong to any invoices
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id FROM account_items WHERE type='tax' AND customid='" . $this->id . "'";
     $sql_obj->execute();
     if ($sql_obj->num_rows()) {
         $this->locked = 1;
     }
     /*
     	Define form structure
     */
     $this->obj_form = new form_input();
     $this->obj_form->formname = "tax_delete";
     $this->obj_form->language = $_SESSION["user"]["lang"];
     $this->obj_form->action = "accounts/taxes/delete-process.php";
     $this->obj_form->method = "post";
     // general
     $structure = NULL;
     $structure["fieldname"] = "name_tax";
     $structure["type"] = "text";
     $this->obj_form->add_input($structure);
     // hidden
     $structure = NULL;
     $structure["fieldname"] = "id_tax";
     $structure["type"] = "hidden";
     $structure["defaultvalue"] = $this->id;
     $this->obj_form->add_input($structure);
     // confirm delete
     $structure = NULL;
     $structure["fieldname"] = "delete_confirm";
     $structure["type"] = "checkbox";
     $structure["options"]["label"] = "Yes, I wish to delete this tax and realise that once deleted the data can not be recovered.";
     $this->obj_form->add_input($structure);
     // define submit field
     $structure = NULL;
     $structure["fieldname"] = "submit";
     $structure["type"] = "submit";
     $structure["defaultvalue"] = "delete";
     $this->obj_form->add_input($structure);
     // define subforms
     $this->obj_form->subforms["tax_delete"] = array("name_tax");
     $this->obj_form->subforms["hidden"] = array("id_tax");
     if ($this->locked) {
         $this->obj_form->subforms["submit"] = array();
     } else {
         $this->obj_form->subforms["submit"] = array("delete_confirm", "submit");
     }
     // fetch the form data
     $this->obj_form->sql_query = "SELECT name_tax FROM `account_taxes` WHERE id='" . $this->id . "' LIMIT 1";
     $this->obj_form->load_data();
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:52,代码来源:delete.php

示例11: quote

 function check_requirements()
 {
     // verify that the quote exists
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id FROM account_quotes WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     if (!$sql_obj->num_rows()) {
         log_write("error", "page_output", "The requested quote (" . $this->id . ") does not exist - possibly the quote has been deleted or converted into an invoice.");
         return 0;
     }
     unset($sql_obj);
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:13,代码来源:quotes-export.php

示例12: product

 function check_requirements()
 {
     // verify that the product exists
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id FROM products WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     if (!$sql_obj->num_rows()) {
         log_write("error", "page_output", "The requested product (" . $this->id . ") does not exist - possibly the product has been deleted.");
         return 0;
     }
     unset($sql_obj);
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:13,代码来源:journal.php

示例13: transaction

 function check_requirements()
 {
     // verify that the account exists
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id, locked FROM account_gl WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     if (!$sql_obj->num_rows()) {
         log_write("error", "page_output", "The requested transaction (" . $this->id . ") does not exist - possibly the transaction has been deleted.");
         return 0;
     } else {
         $sql_obj->fetch_array();
         $this->locked = $sql_obj->data[0]["locked"];
     }
     unset($sql_obj);
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:16,代码来源:delete.php

示例14: service

 function check_requirements()
 {
     // verify that the service exists
     $sql_obj = new sql_query();
     $sql_obj->string = "SELECT id FROM services WHERE id='" . $this->id . "' LIMIT 1";
     $sql_obj->execute();
     if (!$sql_obj->num_rows()) {
         log_write("error", "page_output", "The requested service (" . $this->id . ") does not exist - possibly the service has been deleted.");
         return 0;
     }
     unset($sql_obj);
     // verify that this is a bundle service
     if ($this->service_type != "bundle") {
         log_write("error", "page_output", "The requested service is not a bundle service.");
         return 0;
     }
     return 1;
 }
开发者ID:carriercomm,项目名称:amberdms-bs,代码行数:18,代码来源:bundles.php

示例15: config_generate_uniqueid

function config_generate_uniqueid($config_name, $check_sql)
{
    log_debug("inc_misc", "Executing config_generate_uniqueid({$config_name})");
    $config_name = strtoupper($config_name);
    $returnvalue = 0;
    $uniqueid = 0;
    // fetch the starting ID from the config DB
    $uniqueid = sql_get_singlevalue("SELECT value FROM config WHERE name='{$config_name}'");
    if (!$uniqueid) {
        die("Unable to fetch {$config_name} value from config database");
    }
    // first set the uniqueid prefix to an empty string, in case the following tests fail
    $uniqueid_prefix = '';
    if (!is_numeric($uniqueid)) {
        preg_match("/^(\\S*?)([0-9]*)\$/", $uniqueid, $matches);
        $uniqueid_prefix = $matches[1];
        $uniqueid = (int) $matches[2];
    }
    if ($check_sql) {
        // we will use the supplied SQL query to make sure this value is not currently used
        while ($returnvalue == 0) {
            $sql_obj = new sql_query();
            $sql_obj->string = str_replace("VALUE", $uniqueid_prefix . $uniqueid, $check_sql);
            $sql_obj->execute();
            if ($sql_obj->num_rows()) {
                // the ID has already been used, try incrementing
                $uniqueid++;
            } else {
                // found an avaliable ID
                $returnvalue = $uniqueid;
            }
        }
        $returnvalue = $uniqueid_prefix . $returnvalue;
    } else {
        // conducting no DB checks.
        $returnvalue = $uniqueid_prefix . $uniqueid;
    }
    // update the DB with the new value + 1
    $uniqueid++;
    $sql_obj = new sql_query();
    $sql_obj->string = "UPDATE config SET value='{$uniqueid_prefix}{$uniqueid}' WHERE name='{$config_name}'";
    $sql_obj->execute();
    return $returnvalue;
}
开发者ID:claybbs,项目名称:namedmanager,代码行数:44,代码来源:inc_misc.php


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