本文整理汇总了PHP中sql_query::fetch_array方法的典型用法代码示例。如果您正苦于以下问题:PHP sql_query::fetch_array方法的具体用法?PHP sql_query::fetch_array怎么用?PHP sql_query::fetch_array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sql_query
的用法示例。
在下文中一共展示了sql_query::fetch_array方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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;
}
示例2: 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");
}
}
示例3: 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.
*/
}
示例4: 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;
}
示例5: 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;
}
示例6: 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 phase exists and belongs to this project
if ($this->phaseid) {
$sql_obj = new sql_query();
$sql_obj->string = "SELECT projectid FROM project_phases WHERE id='" . $this->phaseid . "' LIMIT 1";
$sql_obj->execute();
if (!$sql_obj->num_rows()) {
log_write("error", "page_output", "The requested phase (" . $this->phaseid . ") does not exist - possibly the phase has been deleted.");
return 0;
} else {
$sql_obj->fetch_array();
if ($sql_obj->data[0]["projectid"] != $this->id) {
log_write("error", "page_output", "The requested phase (" . $this->phaseid . ") does not belong to the selected project (" . $this->id . ")");
return 0;
}
}
unset($sql_obj);
}
return 1;
}
示例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>";
}
}
示例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.
*/
}
示例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.
*/
}
示例10: execute
function execute()
{
/*
Fetch period data
*/
$sql_period_obj = new sql_query();
$sql_period_obj->string = "SELECT date_start, date_end FROM services_customers_periods WHERE id='" . $this->id_service_period . "' LIMIT 1";
$sql_period_obj->execute();
$sql_period_obj->fetch_array();
/*
Fetch call charges for this period into table.
*/
// establish a new table object
$this->obj_table = new table();
$this->obj_table->language = $_SESSION["user"]["lang"];
$this->obj_table->tablename = "service_history_cdr";
// define all the columns and structure
$this->obj_table->add_column("date", "date", "");
$this->obj_table->add_column("standard", "rate_billgroup", "cdr_rate_billgroups.billgroup_name");
$this->obj_table->add_column("standard", "number_src", "usage1");
$this->obj_table->add_column("standard", "number_dst", "usage2");
$this->obj_table->add_column("standard", "billable_seconds", "usage3");
$this->obj_table->add_column("money_float", "price", "");
// defaults
$this->obj_table->columns = array("date", "rate_billgroup", "number_src", "number_dst", "billable_seconds", "price");
$this->obj_table->columns_order = array("date", "rate_billgroup", "number_src", "number_dst");
// totals
$this->obj_table->total_columns = array("billable_seconds", "price");
// define SQL structure
$this->obj_table->sql_obj->prepare_sql_settable("service_usage_records");
$this->obj_table->sql_obj->prepare_sql_addjoin("LEFT JOIN cdr_rate_billgroups ON cdr_rate_billgroups.id = service_usage_records.billgroup");
$this->obj_table->sql_obj->prepare_sql_addfield("id", "service_usage_records.id");
$this->obj_table->sql_obj->prepare_sql_addwhere("id_service_customer = '" . $this->obj_customer->id_service_customer . "'");
$this->obj_table->sql_obj->prepare_sql_addwhere("date >= '" . $sql_period_obj->data[0]["date_start"] . "'");
$this->obj_table->sql_obj->prepare_sql_addwhere("date <= '" . $sql_period_obj->data[0]["date_end"] . "'");
// acceptable filter options
$structure = NULL;
$structure["fieldname"] = "searchbox";
$structure["type"] = "input";
$structure["sql"] = "(number_src LIKE '%value%' OR number_dst LIKE '%value%')";
$this->obj_table->add_filter($structure);
$this->obj_table->add_fixed_option("id_customer", $this->obj_customer->id);
$this->obj_table->add_fixed_option("id_service_customer", $this->obj_customer->id_service_customer);
$this->obj_table->add_fixed_option("id_service_period", $this->id_service_period);
// load settings from options form
$this->obj_table->load_options_form();
// run SQL query
$this->obj_table->generate_sql();
$this->obj_table->load_data_sql();
}
示例11: project
function check_requirements()
{
// verify that project exists
$sql_obj = new sql_query();
$sql_obj->string = "SELECT id, name_project 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;
} else {
$sql_obj->fetch_array();
$this->name_project = $sql_obj->data[0]["name_project"];
}
unset($sql_obj);
return 1;
}
示例12: 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;
}
示例13: execute
function execute()
{
/*
Fetch period data
*/
$sql_period_obj = new sql_query();
$sql_period_obj->string = "SELECT date_start, date_end FROM services_customers_periods WHERE id='" . $this->id_service_period . "' LIMIT 1";
$sql_period_obj->execute();
$sql_period_obj->fetch_array();
/*
Generate CSV CDR Output
*/
$options = array('id_customer' => $this->obj_customer->id, 'id_service_customer' => $this->obj_customer->id_service_customer, 'period_start' => $sql_period_obj->data[0]["date_start"], 'period_end' => $sql_period_obj->data[0]["date_end"]);
$csv = new cdr_csv($options);
if (!($this->output = $csv->getCSV())) {
log_write("error", "page_output", "Unable to generate CSV ouput for the configured range");
return 0;
}
return 1;
}
示例14: execute
function execute()
{
/*
Define form structure
*/
$this->obj_form = new form_input();
$this->obj_form->formname = "config_integration";
$this->obj_form->language = $_SESSION["user"]["lang"];
$this->obj_form->action = "admin/config_integration-process.php";
$this->obj_form->method = "post";
// customer portal stuff
$structure = NULL;
$structure["fieldname"] = "MODULE_CUSTOMER_PORTAL";
$structure["type"] = "checkbox";
$structure["options"]["no_translate_fieldname"] = "yes";
$structure["options"]["label"] = "Enable/disable the customer portal integration.";
$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["config_integration"] = array("MODULE_CUSTOMER_PORTAL");
$this->obj_form->subforms["submit"] = array("submit");
if (error_check()) {
// load error datas
$this->obj_form->load_data_error();
} else {
// fetch all the values from the database
$sql_config_obj = new sql_query();
$sql_config_obj->string = "SELECT name, value FROM config ORDER BY name";
$sql_config_obj->execute();
$sql_config_obj->fetch_array();
foreach ($sql_config_obj->data as $data_config) {
$this->obj_form->structure[$data_config["name"]]["defaultvalue"] = $data_config["value"];
}
unset($sql_config_obj);
}
}
示例15: execute
//.........这里部分代码省略.........
$structure["type"] = "text";
$structure["defaultvalue"] = lang_trans("record_header_type");
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "record_header_ttl";
$structure["type"] = "text";
$structure["defaultvalue"] = lang_trans("record_header_ttl");
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "record_header_prio";
$structure["type"] = "text";
$structure["defaultvalue"] = lang_trans("record_header_prio");
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "record_header_name";
$structure["type"] = "text";
$structure["defaultvalue"] = lang_trans("record_header_name");
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "record_header_content";
$structure["type"] = "text";
$structure["defaultvalue"] = lang_trans("record_header_content");
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "record_header_import";
$structure["type"] = "text";
$structure["defaultvalue"] = lang_trans("record_header_import");
$this->obj_form->add_input($structure);
// draw pre-defined nameserver records
$obj_sql = new sql_query();
$obj_sql->string = "SELECT server_name FROM name_servers";
$obj_sql->execute();
if ($obj_sql->num_rows()) {
$obj_sql->fetch_array();
$i = 0;
foreach ($obj_sql->data as $data_ns) {
$i++;
// record form items
$structure = NULL;
$structure["fieldname"] = "ns_" . $i . "_type";
$structure["type"] = "text";
$structure["defaultvalue"] = "NS";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "ns_" . $i . "_ttl";
$structure["type"] = "text";
$structure["defaultvalue"] = $GLOBALS["config"]["DEFAULT_TTL_NS"];
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "ns_" . $i . "_prio";
$structure["type"] = "text";
$structure["defaultvalue"] = "";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "ns_" . $i . "_name";
$structure["type"] = "text";
$structure["defaultvalue"] = "@";
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "ns_" . $i . "_content";
$structure["type"] = "text";
$structure["defaultvalue"] = $data_ns["server_name"];
$this->obj_form->add_input($structure);
$structure = NULL;
$structure["fieldname"] = "ns_" . $i . "_import";
$structure["type"] = "checkbox";