- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个脚本,它向我显示 MySQL 表中的数据以及我可以在其中添加/编辑员工的位置。有 2 个表,1 个用于部门,1 个用于员工。
我的脚本仅捕获“Employees”表中的数据,但该表仅显示部门 ID,而不是部门名称。
现在我想要的是
如何在当前脚本中实现这一目标?我有 2 个文件:index.php 和 aev.php:
<?php
#####################
# required settings #
#####################
session_start();
require_once("aev/aev.php");
$tabledit = new MySQLtabledit();
# database settings:
$tabledit->database = 'my_site_db';
$tabledit->host = 'localhost';
$tabledit->user = 'root';
$tabledit->pass = '****';
# table of the database
$tabledit->table = 'aevinew2_workforce_employees';
# the primary key of the table (must be AUTO_INCREMENT)
$tabledit->primary_key = 'id';
# the fields you want to see in "list view"
$tabledit->fields_in_list_view = array('id','fname','lname','position','department','phone1','phone2','geboortedatum','icon');
#####################
# optional settings #
#####################
# language (en of nl)
$tabledit->language = 'nl';
# numbers of rows/records in "list view"
$tabledit->num_rows_list_view = 15;
# required fields in edit or add record
$tabledit->fields_required = array('fname','lname','position','department','phone1','geboortedatum');
# help text
$tabledit->help_text = array(
'id' => "Don't edit this field",
'fname' => "Verplicht veld",
'lname' => "Verplicht veld",
'position' => "Verplicht veld",
'department' => "Verplicht veld",
'email' => "Niet verplicht",
'phone1' => "Verplicht veld",
'phone2' => "Alleen invullen indien van toepassing",
'geboortedatum' => "Verplicht veld. Gebruik datum notatie YYYY-MM-DD",
'locstate' => "Veld leeg laten",
'featured' => "Veld leeg laten",
'icon' => "Selecteer afbeelding (functie nog niet beschikbaar)",
'bio' => "Veld leeg laten",
'ordering' => "Veld leeg laten",
'state' => "Veld leeg laten",
'website' => "Veld leeg laten",
'user_id' => "Veld leeg laten",
);
# visible name of the fields
$tabledit->show_text = array(
'id' => 'ID',
'fname' => 'Voornaam',
'lname' => 'Achternaam',
'position' => 'Functie',
'department' => 'Afdeling',
'email' => 'Email',
'phone1' => 'Telefoonnummer',
'phone2' => 'GSM',
'geboortedatum'=> 'Geboortedatum',
'locstate' => 'Status geblokkeerd',
'icon' => 'Foto',
'bio' => 'Biografie',
'ordering' => 'Sortering',
'state' => 'Status',
'website' => 'Website',
'user_id' => 'UserID',
);
$tabledit->width_editor = '100%';
$tabledit->width_input_fields = '500px';
$tabledit->width_text_fields = '498px';
$tabledit->height_text_fields = '200px';
# warning no .htacces ('on' or 'off')
$tabledit->no_htaccess_warning = 'off';
####################################
# connect, show editor, disconnect #
####################################
$tabledit->database_connect();
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3.org/TR/html4/loose.dtd'>
<html>
<head>
<title>Werknemers Aevitae</title>
</head>
<body>
";
$tabledit->do_it();
echo "
</body>
</html>"
;
$tabledit->database_disconnect();
?>
<?php
// no direct access
if(strtolower(basename($_SERVER['PHP_SELF'])) == strtolower(basename(__FILE__))) {
die('No access...');
}
class MySQLtabledit {
/**
*
* Werknemersbestand Aevitae
*
* Copyright (c) 2015 Richard Vliegen, Aevitae BV
*/
var $version = '1.0';
# text
var $text;
# language
var $language = 'en';
# database settings
var $database;
var $host;
var $user;
var $pass;
# table of the database
var $table;
# the primary key of the table
var $primary_key;
# the fields you want to see in "list view"
var $fields_in_list_view;
# numbers of rows/records in "list view"
var $num_rows_list_view = 15;
# required fields in edit or add record
var $fields_required;
# help text
var $help_text;
# visible name of the fields
var $show_text;
var $width_editor = '100%';
var $width_input_fields = '500px';
var $width_text_fields = '498px';
var $height_text_fields = '200px';
# warning no .htacces ('on' or 'off')
var $no_htaccess_warning = 'off';
var $url_base;
var $query_joomla_component;
###########################
function database_connect() {
###########################
if (!mysql_connect($this->host, $this->user, $this->pass)) {
die('Could not connect: ' . mysql_error());
}
mysql_select_db($this->database);
}
##############################
function database_disconnect() {
##############################
mysql_close();
}
################
function do_it() {
################
require_once("./lang/en.php");
require_once("./lang/" . $this->language . ".php");
# No cache
if(!headers_sent()) {
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: post-check=0, pre-check=0', false);
header('Pragma: no-cache');
header("Cache-control: private");
}
if (!$this->url_base) $this->url_base = '.';
# name of the script
$break = explode('/', $_SERVER["SCRIPT_NAME"]);
$this->url_script = $break[count($break) - 1];
if ($_GET['mte_a'] == 'edit') {
$this->edit_rec();
}
elseif ($_GET['mte_a'] == 'new') {
$this->edit_rec();
}
elseif ($_GET['mte_a'] == 'del') {
$this->del_rec();
}
elseif ($_POST['mte_a'] == 'save') {
$this->save_rec();
}
else {
$this->show_list();
}
$this->close_and_print();
}
####################
function show_list() {
####################
# message after add or edit
$this->content_saved = $_SESSION['content_saved'];
$_SESSION['content_saved'] = '';
# default sort (a = ascending)
$ad = 'a';
if ($_GET['sort'] && in_array($_GET['sort'],$this->fields_in_list_view) ) {
if ($_GET['ad'] == 'a') $asc_des = 'ASC';
if ($_GET['ad'] == 'd') $asc_des = 'DESC';
$order_by = "ORDER by " . $_GET['sort'] . ' ' . $asc_des ;
}
else {
$order_by = "ORDER by $this->primary_key DESC";
}
# navigation 1/3
$start = $_GET["start"];
if (!$start) {$start = 0;} else {$start *=1;}
// build query_string
// query_joomla_component (joomla)
if ($this->query_joomla_component) $query_string = '&option=' . $this->query_joomla_component ;
// navigation
$query_string .= '&start=' . $start;
// sorting
$query_string .= '&ad=' . $_GET['ad'] . '&sort=' . $_GET['sort'] ;
// searching
$query_string .= '&s=' . $_GET['s'] . '&f=' . $_GET['f'] ;
# search
if ($_GET['s'] && $_GET['f']) {
$in_search = addslashes(stripslashes($_GET['s']));
$in_search_field = $_GET['f'];
if ($in_search_field == $this->primary_key) {
$where_search = "WHERE $in_search_field = '$in_search' ";
}
else {
$where_search = "WHERE $in_search_field LIKE '%$in_search%' ";
}
}
# select
$sql = "SELECT * FROM `$this->table` $where_search $order_by";
$result = mysql_query($sql);
# navigation 2/3
$hits_total = mysql_num_rows($result);
$sql .= " LIMIT $start, $this->num_rows_list_view";
$result = mysql_query($sql);
if (mysql_num_rows($result)>0) {
$count = 0;
while ($rij = mysql_fetch_assoc($result)) {
$count++;
$this_row = '';
if ($background == '#eee') {$background='#fff';}
else {$background='#eee';}
foreach ($rij AS $key => $value) {
$sort_image = '';
if (in_array($key, $this->fields_in_list_view)) {
if ($count == 1) {
// show nice text of a value
if ($this->show_text[$key]) {$show_key = $this->show_text[$key];}
else {$show_key = $key;}
// sorting
if ($_GET['sort'] == $key && $_GET['ad'] == 'a') {
$sort_image = "<IMG SRC='$this->url_base/images/sort_a.png' WIDTH=9 HEIGHT=8 BORDER=0 ALT=''>";
$ad = 'd';
}
if ($_GET['sort'] == $key && $_GET['ad'] == 'd') {
$sort_image = "<IMG SRC='$this->url_base/images/sort_d.png' WIDTH=9 HEIGHT=8 BORDER=0 ALT=''>";
$ad = 'a';
}
// remove sort and ad and add new ones
$query_sort = preg_replace('/&(sort|ad)=[^&]*/','', $query_string) . "&sort=$key&ad=$ad";
$head .= "<td NOWRAP><a href='$this->url_script?$query_sort' class='mte_head'>$show_key</a> $sort_image</td>";
}
if ($key == $this->primary_key) {
$buttons = "<td NOWRAP><a href='javascript:void(0)' onclick='del_confirm($value)' title='Delete {$this->show_text[$key]} $value'><IMG SRC='$this->url_base/images/del.png' WIDTH=16 HEIGHT=16 BORDER=0 ALT=''></a> <a href='?$query_string&mte_a=edit&id=$value' title='Edit {$this->show_text[$key]} $value'><IMG SRC='$this->url_base/images/edit.png' WIDTH=16 HEIGHT=16 BORDER=0 ALT=''></a></td>";
$this_row .= "<td>$value</td>";
}
else {
$this_row .= '<td>' . substr(strip_tags($value), 0, 300) . '</td>';
}
}
}
$rows .= "<tr style='background:$background'>$buttons $this_row</tr>";
}
}
else {
$head = "<td style='padding:50px'>{$this->text['Nothing_found']}...</td>";
}
# navigation 3/3
# remove start= from url
$query_nav = preg_replace('/&(start|mte_a|id)=[^&]*/','', $query_string );
# this page
$this_page = ($this->num_rows_list_view + $start)/$this->num_rows_list_view;
# last page
$last_page = ceil($hits_total/$this->num_rows_list_view);
# navigatie numbers
if ($this_page>10) {
$vanaf = $this_page - 10;
}
else {$vanaf = 1;}
if ($last_page>$this_page + 10) {
$tot = $this_page + 10;
}
else {$tot = $last_page; }
for ($f=$vanaf;$f<=$tot;$f++) {
$nav_toon = $this->num_rows_list_view * ($f-1);
if ($f == $this_page) {
$navigation .= "<td class='mte_nav' style='color:#fff;background: #808080;font-weight: bold'>$f</td> ";
}
else {
$navigation .= "<td class='mte_nav' style='background: #fff'><A HREF='$this->url_script?$query_nav&start=$nav_toon'>$f</A></td>";
}
}
if ($hits_total<$this->num_rows_list_view) { $navigation = '';}
# Previous if
if ($this_page > 1) {
$last = (($this_page - 1) * $this->num_rows_list_view ) - $this->num_rows_list_view;
$last_page_html = "<A HREF='$this->url_script?$query_nav&start=$last' class='mte_nav_prev_next'>{$this->text['Previous']}</A>";
}
# Next if:
if ($this_page != $last_page && $hits_total>1) {
$next = $start + $this->num_rows_list_view;
$next_page_html = "<A HREF='$this->url_script?$query_nav&start=$next' class='mte_nav_prev_next'>{$this->text['Next']}</A>";
}
if ($navigation) {
$nav_table = "
<table cellspacing=5 cellpadding=0 style='border: 0px solid white'>
<tr>
<td style='padding-right:6px;vertical-align: middle'>$last_page_html</td>
$navigation
<td style='padding-left:6px;vertical-align: middle'>$next_page_html</td>
</tr>
</table>
";
$this->nav_top = "
<div style='margin: -10px 0 20px 0;width: $this->width_editor'>
<center>
$nav_table
</center>
</div>
";
$this->nav_bottom = "
<div style='margin: 20px 0 0 0;width: $this->width_editor'>
<center>
$nav_table
</center>
</div>
";
}
# Search form + Add Record button
foreach ($this->fields_in_list_view AS $option) {
if ($this->show_text[$option]) {$show_option = $this->show_text[$option];}
else {$show_option = $option;}
if ($option == $in_search_field) {
$options .= "<option selected value='$option'>$show_option</option>";
}
else {
$options .= "<option value='$option'>$show_option</option>";
}
}
$in_search_value = htmlentities(trim(stripslashes($_GET['s'])), ENT_QUOTES);
$seach_form = "
<table cellspacing=0 cellpadding=0 border=0>
<tr>
<td nowrap>
<form method=get action='$this->url_script' style='padding: 15px'>
<select name='f'>$options</select>
<input type='text' name='s' value='$in_search_value' style='width:200px'>
<input type='submit' value='{$this->text['Search']}' style='width:80px; border: 1px solid #000'>
";
if ($this->query_joomla_component) $seach_form .= "<input type='hidden' value='$this->query_joomla_component' name='option'>";
$seach_form .= "</form>";
if ($_GET['s'] && $_GET['f']) {
if ($this->query_joomla_component) $add_joomla = '?option=' . $this->query_joomla_component;
$seach_form .= "<button onclick='window.location=\"$this->url_script$add_joomla\"' style='margin: 0 0 15px 15px; border: 1px solid #000;'>{$this->text['Clear_search']}</button>";
}
$seach_form .= "
</td>
<td style='padding: 15px; text-align: right; width: $this->width_editor'>
<button onclick='window.location=\"$this->url_script?$query_string&mte_a=new\"' style='margin: 0 0 15px 15px; border: 1px solid #000;'>{$this->text['Add_Record']}</button>
</td>
</tr>
</table>
";
$this->javascript = "
function del_confirm(id) {
if (confirm('{$this->text['Delete']} record {$this->show_text[$this->primary_key]} ' + id + '...?')) {
window.location='$this->url_script?$query_string&mte_a=del&id=' + id
}
}
";
# page content
$this->content = "
<div style='width: $this->width_editor;background:#454545; margin: 0'>$seach_form</div>
<table cellspacing=0 cellpadding=10 style='margin: 0; width: $this->width_editor;'>
<tr style='background:#626262; color: #fff'><td></td>$head</tr>
$rows
</table>
$this->nav_bottom
";
}
##################
function del_rec() {
##################
$in_id = $_GET['id'];
if (mysql_query("DELETE FROM $this->table WHERE `$this->primary_key` = '$in_id'")) {
$this->content_deleted = "
<div style='width: $this->width_editor'>
<div style='padding: 10px; color:#fff; background: #FF8000; font-weight: bold'>Record {$this->show_text[$this->primary_key]} $in_id {$this->text['deleted']}</div>
</div>
";
$this->show_list();
}
else {
$this->content = "
</div>
<div style='padding:2px 20px 20px 20px;margin: 0 0 20px 0; background: #DF0000; color: #fff;'><h3>Error</h3>" .
mysql_error().
"</div><a href='$this->url_script'>List records...</a>
</div>";
}
}
###################
function edit_rec() {
###################
$in_id = $_GET['id'];
# edit or new?
if ($_GET['mte_a'] == 'edit') $edit=1;
$count_required = 0;
$result = mysql_query("SHOW COLUMNS FROM `$this->table`");
# get field types
while ($rij = mysql_fetch_array($result)) {
extract($rij);
$field_type[$Field] = $Type;
}
if (!$edit) {
$rij = $field_type;
}
else {
if ($edit) $where_edit = "WHERE `$this->primary_key` = $in_id";
$result = mysql_query("SELECT * FROM `$this->table` $where_edit LIMIT 1 ;");
$rij = mysql_fetch_assoc($result);
}
foreach ($rij AS $key => $value) {
if (!$edit) $value = '';
$field = '';
$options = '';
$style = '';
$field_id = '';
$readonly = '';
$value_htmlentities = '';
if (in_array($key, $this->fields_required)) {
$count_required++;
$style = "class='mte_req'";
$field_id = "id='id_" . $count_required . "'";
}
$field_kind = $field_type[$key];
# different fields
# textarea
if (preg_match("/text/", $field_kind)) {
$field = "<textarea name='$key' $style $field_id>$value</textarea>";
}
# select/options
elseif (preg_match("/enum\((.*)\)/", $field_kind, $matches)) {
$all_options = substr($matches[1],1,-1);
$options_array = explode("','",$all_options);
foreach ($options_array AS $option) {
if ($option == $value) {
$options .= "<option selected>$option</option>";
}
else {
$options .= "<option>$option</option>";
}
}
$field = "<select name='$key' $style $field_id>$options</select>";
}
# input
elseif (!preg_match("/blob/", $field_kind)) {
if (preg_match("/\(*(.*)\)*/", $field_kind, $matches)) {
if ($key == $this->primary_key) {
$style = "style='background:#ccc'";
$readonly = 'readonly';
}
$value_htmlentities = htmlentities($value, ENT_QUOTES);
if (!$edit && $key == $this->primary_key) {
$field = "<input type='hidden' name='$key' value=''>[auto increment]";
}
else {
$field = "<input type='text' name='$key' value='$value_htmlentities' maxlength='{$matches[1]}' $style $readonly $field_id>";
}
}
}
# blob: don't show
elseif (preg_match("/blob/", $field_kind)) {
$field = '[<i>binary</i>]';
}
# make table row
if ($background == '#eee') {$background='#fff';}
else {$background='#eee';}
if ($this->show_text[$key]) {$show_key = $this->show_text[$key];}
else {$show_key = $key;}
$rows .= "\n\n<tr style='background:$background'>\n<td><b>$show_key</b></td>\n<td>$field</td>\n<td style='width:50%'>{$this->help_text[$key]}</td>\n</tr>";
}
$this->javascript = "
function submitform() {
var ok = 0;
for (f=1;f<=$count_required;f++) {
var elem = document.getElementById('id_' + f);
if(elem.options) {
if (elem.options[elem.selectedIndex].text!=null && elem.options[elem.selectedIndex].text!='') {
ok++;
}
}
else {
if (elem.value!=null && elem.value!='') {
ok++;
}
}
}
// alert($count_required + ' ' + ok);
if (ok == $count_required) {
return true;
}
else {
alert('{$this->text['Check_the_required_fields']}...')
return false;
}
}
";
$this->content = "
<div style='width: $this->width_editor;background:#454545'>
<table cellspacing=0 cellpadding=0 style='border: 0px solid white'>
<tr>
<td>
<button onclick='window.location=\"{$_SESSION['hist_page']}\";' style='margin: 20px 15px 25px 15px; border: 1px solid #000;'>{$this->text['Go_back']}</button></td>
<td>
<form method=post action='$this->url_script' onsubmit='return submitform()'>
<input type='submit' value='{$this->text['Save']}' style='width: 80px;border: 1px solid #000; margin: 20px 0 25px 0'></td>
</tr>
</table>
</div>
<div style='width: $this->width_editor'>
<table cellspacing=0 cellpadding=10 style='100%; margin: 0'>
$rows
</table>
</div>
";
if (!$edit) $this->content .= "<input type='hidden' name='mte_new_rec' value='1'>";
if ($this->query_joomla_component) $this->content .= "<input type='hidden' name='option' value='$this->query_joomla_component'>";
$this->content .= "
<input type='hidden' name='mte_a' value='save'>
</form>
";
}
###################
function save_rec() {
###################
$in_mte_new_rec = $_POST['mte_new_rec'];
$updates = '';
foreach($_POST AS $key => $value) {
if ($key == $this->primary_key) {
$in_id = $value;
$where = "$key = $value";
}
if ($key != 'mte_a' && $key != 'mte_new_rec' && $key != 'option') {
if ($in_mte_new_rec) {
$insert_fields .= " `$key`,";
$insert_values .= " '" . addslashes(stripslashes($value)) . "',";
}
else {
$updates .= " `$key` = '" . addslashes(stripslashes($value)) . "' ,";
}
}
}
$insert_fields = substr($insert_fields,0,-1);
$insert_values = substr($insert_values,0,-1);
$updates = substr($updates,0,-1);
# new record:
if ($in_mte_new_rec) {
$sql = "INSERT INTO `$this->table` ($insert_fields) VALUES ($insert_values); ";
}
# edit record:
else {
$sql = "UPDATE `$this->table` SET $updates WHERE $where LIMIT 1; ";
}
//echo $sql; exit;
if (mysql_query($sql)) {
if ($in_mte_new_rec) {
$saved_id = mysql_insert_id();
$_GET['s'] = $saved_id;
$_GET['f'] = $this->primary_key;
}
else {
$saved_id = $in_id;
}
if ($this->show_text[$this->primary_key]) {$show_primary_key = $this->show_text[$this->primary_key];}
else {$show_primary_key = $this->primary_key;}
$_SESSION['content_saved'] = "
<div style='width: $this->width_editor'>
<div style='padding: 10px; color:#fff; background: #67B915; font-weight: bold'>Record $show_primary_key $saved_id {$this->text['saved']}</div>
</div>
";
if ($in_mte_new_rec) {
echo "<script>window.location='?start=0&f=&sort=" . $this->primary_key . "&ad=d";
if ($this->query_joomla_component) {
echo '&option=' . $this->query_joomla_component ;
}
echo "'</script>";
}
else {
echo "<script>window.location='" . $_SESSION['hist_page'] . "'</script>";
}
}
else {
$this->content = "
<div style='width: $this->width_editor'>
<div style='padding:2px 20px 20px 20px;margin: 0 0 20px 0; background: #DF0000; color: #fff;'><h3>Error</h3>" .
mysql_error() .
"</div><a href='{$_SESSION['hist_page']}'>{$this->text['Go_back']}...</a>
</div>";
}
}
##########################
function close_and_print() {
##########################
# debug and warning no htaccess
if ($this->debug) $this->debug .= '<br />';
if (!file_exists('./.htaccess') && $this->no_htaccess_warning == 'on') $this->debug .= "{$this->text['Protect_this_directory_with']} .htaccess";
if ($this->debug)
$this->debug_html = "
<div style='width: $this->width_editor'>
<div class='mte_mess' style='background: #DD0000'>$this->debug</div>
</div>";
# save page location
$session_hist_page = $this->url_script . '?' . $_SERVER['QUERY_STRING'];
if ($this->query_joomla_component && !preg_match("/option=$this->query_joomla_component/",$session_hist_page)) {
$session_hist_page .= '&option=' . $this->query_joomla_component;
}
// no page history on the edit page because after refresh the Go Back is useless
if (!$_GET['mte_a']) {
$_SESSION['hist_page'] = $session_hist_page;
}
if ($this->query_joomla_component) $add_joomla = '?option=' . $this->query_joomla_component;
echo "
<script language='javascript'>
$this->javascript
</script>
<link href='$this->url_base/css/mte.css' rel='stylesheet' type='text/css'>
<style type='text/css'>
.mte_content input {
width: $this->width_input_fields;
}
.mte_content textarea {
width: $this->width_text_fields;
height: $this->height_text_fields;
}
</style>
<div class='mte_content'>
<div class='mte_head_1'><a href='$this->url_script$add_joomla' style='text-decoration: none;color: #797979'>Aevitae Werknemers</a> <span style='color: #ddd'>$this->version</span></div>
<div class='mte_logo'></div>
$this->nav_top
$this->debug_html
$this->content_saved
$this->content_deleted
$this->content
</div>
";
}
}
?>
最佳答案
为了回答查找问题,我认为您的类(class)本身不支持此功能?您需要添加该功能。我会做这样的事情:
/**
* Converts a FK column to a lookup column
*
* @param $columnName The name of the column in the current table
* @param $foreignTable The name of the foreign table
* @param $foreignKey The primary key in the foreign table
* @param $foreignTextColumn The column to use as a lookup
*/
public function declareLookupColumn($columnName, $foreignTable, $foreignKey, $foreignTextColumn)
{
// @todo Store these values in your class, so you can examine
// them when the table is rendered
}
您还需要修改表格呈现代码。对于每一列,查看是否已使用此方法声明它,如果是,则发出 SELECT
来获取外部表值。
关于php - 如何在相关表中查找值,以及如何向编辑面板添加下拉菜单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29792927/
我的问题:非常具体。我正在尝试想出解析以下文本的最简单方法: ^^domain=domain_value^^version=version_value^^account_type=account_ty
好吧,这就是我的困境: 我正在为 Reddit 子版 block 开发常见问题解答机器人。我在 bool 逻辑方面遇到了麻烦,需要一双更有经验的眼睛(这是我在 Python 中的第一次冒险)。现在,该
它首先遍历所有 y 值,然后遍历所有 x 值。我需要 X 和 y 同时改变。 For x = 3 To lr + 1 For y = 2 To lr anyl.Cells(x, 1)
假设我有一个包含 2 列的 Excel 表格:单元格 A1 到 A10 中的日期和 B1 到 B10 中的值。 我想对五月日期的所有值求和。我有3种可能性: {=SUM((MONTH(A1:A10)=
如何转换 Z-score来自 Z-distribution (standard normal distribution, Gaussian distribution)到 p-value ?我还没有找到
我正在重写一些 Javascript 代码以在 Excel VBA 中工作。由于在这个网站上搜索,我已经设法翻译了几乎所有的 Javascript 代码!但是,有些代码我无法准确理解它在做什么。这是一
我遇到过包含日期格式的时间戳日期的情况。然后我想构建一个图表,显示“点击”项目的数量“每天”, //array declaration $array1 = array("Date" => 0); $a
我是scala的新手! 我的问题是,是否有包含成员的案例类 myItem:Option[String] 当我构造类时,我需要将字符串内容包装在: Option("some string") 要么 So
我正在用 PHP 创建一个登录系统。我需要用户使用他或她的用户名或电子邮件或电话号码登录然后使用密码。因为我知道在 Java 中我们会像 email==user^ username == user 这
我在 C++ 项目上使用 sqlite,但是当我在具有文本值的列上使用 WHERE 时出现问题 我创建了一个 sqlite 数据库: CREATE TABLE User( id INTEGER
当构造函数是显式时,它不用于隐式转换。在给定的代码片段中,构造函数被标记为 explicit。那为什么在 foo obj1(10.25); 情况下它可以工作,而在 foo obj2=10.25; 情况
我知道这是一个主观问题,所以如果需要关闭它,我深表歉意,但我觉得它经常出现,让我想知道是否普遍偏爱一种形式而不是另一种形式。 显然,最好的答案是“重构代码,这样你就不需要测试是否存在错误”,但有时没有
这两个 jQuery 选择器有什么区别? 以下是来自 w3schools.com 的定义: [attribute~=value] 选择器选择带有特定属性,其值包含特定字符串。 [attribute*=
为什么我们需要CSS [attribute|=value] Selector根本当 CSS3 [attribute*=value] Selector基本上完成相同的事情,浏览器兼容性几乎相似?是否存在
我正在解决 regx 问题。我已经有一个像这样的 regx [0-9]*([.][0-9]{2})。这是 amont 格式验证。现在,通过此验证,我想包括不应提供 0 金额。比如 10 是有效的,但
我正在研究计算机科学 A 考试的样题,但无法弄清楚为什么以下问题的正确答案是正确的。 考虑以下方法。 public static void mystery(List nums) { for (
好的,我正在编写一个 Perl 程序,它有一个我收集的值的哈希值(完全在一个完全独立的程序中)并提供给这个 Perl 脚本。这个散列是 (string,string) 的散列。 我想通过 3 种方式对
我有一个表数据如下,来自不同的表。仅当第三列具有值“债务”并且第一列(日期)具有最大值时,我才想从第四列中获取最大值。最终值基于 MAX(DATE) 而不是 MAX(PRICE)。所以用简单的语言来说
我有一个奇怪的情况,只有错误状态保存到数据库中。当“状态”应该为 true 时,我的查询仍然执行 false。 我有具有此功能的 Controller public function change_a
我有一个交易表(针对所需列进行了简化): id client_id value 1 1 200 2 2 150 3 1
我是一名优秀的程序员,十分优秀!