在窗体中显示mysql复选框值(Display mysql checkbox value in form)
一个简单的问题,但我似乎无法找到答案。
我有一个简单的表单,当选中复选框时,将值“on”插入数据库
当重新访问表单并显示数据库信息时,如何从数据库中提取数据时检查复选框?
我试过这个,但它不起作用
<input type="checkbox" name="positioning" class="input_margin" value="<? $row['positioning']; ?>">Positioning<br />
(我只需要帮助,我有sql查询等设置好)
谢谢
A simple question but I can't seem to find the answer.
I have a simple form that inserts the value 'on' to a database when a checkbox is checked
How do I get the checkbox checked when the data is pulled from the database when the form is revisited and displaying with the database information?
I have tried this but it doesn't work
<input type="checkbox" name="positioning" class="input_margin" value="<? $row['positioning']; ?>">Positioning<br />
(I only need help with this, I have the sql query etc set up fine)
Thanks
原文:https://stackoverflow.com/questions/14306065
最满意答案
你显然索引时间/ 1000
1454256000/1000 = 1454256 -> Sat, 17 Jan 1970 19:57:36 GMT 1454342400/1000 = 1454342 -> Sat, 17 Jan 1970 19:59:02 GMT
这就是为什么他们都属于同一个桶
1970-01-17T19:55:00.000Z
,与您的日期间隔/ 1000相对应You are apparently indexing time / 1000
1454256000/1000 = 1454256 -> Sat, 17 Jan 1970 19:57:36 GMT 1454342400/1000 = 1454342 -> Sat, 17 Jan 1970 19:59:02 GMT
that is why they all fall within the same bucket
1970-01-17T19:55:00.000Z
, corrisponding with your date interval / 1000
相关问答
更多-
不幸的是,唯一的方法是使用自定义映射并更改ES 检测日期的方式 : 我过去所做的就是 插入文档。 提取映射(请参阅此处 )。 根据我的喜好更新映射。 做一个新映射的PUT ......为此,您可能需要创建一个不同的类型,因为有时ES无法动态替换映射。 我从来没有用日期做过这个,但是必须用字段索引的方式做几次。 Unfortunately, the only way to do this is with a custom mapping and changing how ES detects dates: W ...
-
你能看到文件在ElasticSearch中编入索引的时间吗?(Can you see the time a document was indexed in ElasticSearch?)[2023-09-24]
您可以启用_timestamp ,并获得此功能。 You can enable _timestamp , and get this functionality. -
您应该指定only_expunge_deletes参数,默认情况下为false。 curl -XPOST 'http://localhost:9200/_optimize?only_expunge_deletes=true' 运行此操作后,您删除的文档计数应该减少 You should specify the only_expunge_deletes parameter which is false by default. curl -XPOST 'http://localhost:9200/_optim ...
-
当然,没有数据很难测试,但过滤器是错误的。 它应该与第二个查询处于同一级别。 我认为以下解决方案更容易: { "query": { "bool": { "must": [ { "match": { "content": "syria" } } ], "filter": [ { "term": { "sour ...
-
你显然索引时间/ 1000 1454256000/1000 = 1454256 -> Sat, 17 Jan 1970 19:57:36 GMT 1454342400/1000 = 1454342 -> Sat, 17 Jan 1970 19:59:02 GMT 这就是为什么他们都属于同一个桶1970-01-17T19:55:00.000Z ,与您的日期间隔/ 1000相对应 You are apparently indexing time / 1000 1454256000/1000 = 1454256 ...
-
促进Elasticsearch(Boosting in Elasticsearch)[2022-07-09]
查询时间提升允许您给予一个查询比另一个查询更多的权重。 例如,假设您正在查询“Quick Brown Fox”的title和body字段,可以将其写为: { "query": { "bool": { "should": [ { "match": { "title": "Quick Brown Fox" } }, { "match": { ... -
如何在play2-elasticsearch中设置ttl“生存时间”(How to set ttl “time to live” in play2-elasticsearch)[2023-01-26]
@IndexMapping(value = "{ searchResult : { \"_ttl\" : { \"enabled\" : true , \"default\" : \"12h\"} } }") (以发行票https://github.com/cleverage/play2-elasticsearch/issues/64回答) @IndexMapping(value = "{ searchResult : { \"_ttl\" : { \"enabled\" : true , \"defau ... -
这是因为您使用了不分析输入的term查询。 你应该改变它来使用一个match查询,而且一切都会好的 GET people/person/_search { "query": { "bool": { "should": [ { "match": { "state": "al" } } ] } } } This is because you've used a ter ...
-
如何在日志中将时间设置为elasticsearch中的主@timestamp(How to set time in log as main @timestamp in elasticsearch)[2023-02-27]
使用日期过滤器设置@timestamp字段。 将它以任何格式提取的时间戳提取到单独的(临时)字段中,例如timestamp ,并将其提供给日期过滤器。 在你的情况下,你很可能会使用特殊的ISO8601时间戳格式令牌。 filter { date { match => ["timestamp", "ISO8601"] remove_field => ["timestamp"] } } Use the date filter to set the @timestamp field. E ... -
elasticsearch具体时间(elasticsearch specific hours)[2023-07-22]
您可以使用带有多个范围过滤器的过滤布尔查询。 您可以在代码中计算小时日期范围,并动态构建X天数的查询。 以下示例是在00:30计算的3天(因此跨越日界) { "query": { "filtered": { "query": { "match_all": {} }, "filter": { "bool": { ...