小编Bri*_*ian的帖子

给定尺寸的所有矩形的搜索矩阵(选择座位块)

所有,

我一直试图找出如何在一个座位内选择15张票.

编辑:问题是 - 如何找到给定尺寸的所有矩形(例如3x5)的免费座位?

在此输入图像描述

下面是我的表,查询选择4个连续席位(或15或其他),这是好的...

但我想做的是选择说15个座位,这些可以分成多行,即3 x 5,但我希望它们被封锁在一起,即

row 9 ..(some seats)..[5 seats]..(some seats)..
row 8 ..(some seats)..[5 seats]..(some seats)..
row 7 ..(some seats)..[5 seats]..(some seats)..
Run Code Online (Sandbox Code Playgroud)

也就是说,他们将在彼此前面排成3排.row9座位10到25,row8座位10到25,row7座位10到25.

还可能需要考虑座椅块是否具有不同数量的座椅,即角块可以呈弧形以在后部具有比前部更多的座椅.

以ehnaceing SQL或某些算法或某些PHP代码的形式提供的任何指导.一周的大部分时间里,我一直在捣乱自己的大脑.

CREATE TABLE `seats` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `event_id` int(11) DEFAULT NULL,
  `performance` int(11) DEFAULT NULL,
  `block` int(11) DEFAULT NULL,
  `row` int(11) DEFAULT NULL,
  `seat` int(11) DEFAULT NULL,
  `status` int(10) DEFAULT 1,
  PRIMARY KEY (`id`)
) ENGINE=MyISAM AUTO_INCREMENT=11 DEFAULT CHARSET=utf8;
Run Code Online (Sandbox Code Playgroud)

我的查询到了 - 它返回X席的块组合.

SELECT    a.event_id, a.performance, a.block, …
Run Code Online (Sandbox Code Playgroud)

php mysql algorithm ticket-system

15
推荐指数
1
解决办法
3961
查看次数

删除"function(){...}"周围的双引号

大脑今天不工作 - 任何人都可以给我一个转向的正则表达式:

 {events:{click:"function() { alert('hi'); }"}}}}}
Run Code Online (Sandbox Code Playgroud)

成:

 {events:{click:function() { alert('hi'); }}}}}}
Run Code Online (Sandbox Code Playgroud)

字符串中的任何其他实例,例如this.

如果这有助于扩展我的问题:

到目前为止使用这个:

$replacement = '${1}:';
$json_options = preg_replace('/"(\w+)"\s*:/', $replacement, $json_options);
Run Code Online (Sandbox Code Playgroud)

我转过来了:

string(1051) "{"chart":{"renderTo":"tx_count","defaultSeriesType":"spline"},"credits":{"enabled":false},"series":[{"type":"spline","name":"Transactions Per Day","color":"#4572A7","data":[3,5,3,3,3,6,6,92,2]},{"type":"spline","name":"Value Per Day","yAxis":1,"color":"#89A54E","data":[30,232,172.99,30,160,550,596,2407.96,20]},{"type":"spline","name":"Average Value Per Day","yAxis":2,"color":"#AA4643","data":[10,46.4,57.7,10,53.3,91.7,99.3,26.2,10]}],"legend":{"enabled":true},"xAxis":{"labels":{"rotation":"-45"},"categories":["02\/02\/2011","03\/02\/2011","06\/02\/2011","07\/02\/2011","08\/02\/2011","09\/02\/2011","10\/02\/2011","11\/02\/2011","14\/02\/2011"]},"title":{"text":"Transactions Summary","align":"center","x":0,"y":20},"yAxis":[{"title":{"text":"Transactions","style":{"color":"#4572A7"}}},{"title":{"text":"Value","style":{"color":"#89A54E"}},"opposite":true},{"title":{"text":"Value (Average)","style":{"color":"#AA4643"}},"opposite":true}],"plotOptions":{"series":{"cursor":"pointer","point":{"events":{"click":"function() { alert('hi'); }"}}}}}"
Run Code Online (Sandbox Code Playgroud)

进入这个(这是完美的),

string(947) "{chart:{renderTo:"tx_count",defaultSeriesType:"spline"},credits:{enabled:false},series:[{type:"spline",name:"Transactions Per Day",color:"#4572A7",data:[3,5,3,3,3,6,6,92,2]},{type:"spline",name:"Value Per Day",yAxis:1,color:"#89A54E",data:[30,232,172.99,30,160,550,596,2407.96,20]},{type:"spline",name:"Average Value Per Day",yAxis:2,color:"#AA4643",data:[10,46.4,57.7,10,53.3,91.7,99.3,26.2,10]}],legend:{enabled:true},xAxis:{labels:{rotation:"-45"},categories:["02\/02\/2011","03\/02\/2011","06\/02\/2011","07\/02\/2011","08\/02\/2011","09\/02\/2011","10\/02\/2011","11\/02\/2011","14\/02\/2011"]},title:{text:"Transactions Summary",align:"center",x:0,y:20},yAxis:[{title:{text:"Transactions",style:{color:"#4572A7"}}},{title:{text:"Value",style:{color:"#89A54E"}},opposite:true},{title:{text:"Value (Average)",style:{color:"#AA4643"}},opposite:true}],plotOptions:{series:{cursor:"pointer",point:{events:{click:"function() { alert('hi'); }"}}}}}"
Run Code Online (Sandbox Code Playgroud)

现在我需要删除可能在字符串中的任何函数(){... stuff ...}的双引号.

php regex

0
推荐指数
1
解决办法
534
查看次数

标签 统计

php ×2

algorithm ×1

mysql ×1

regex ×1

ticket-system ×1