-
Notifications
You must be signed in to change notification settings - Fork 0
/
function.php
3750 lines (3411 loc) · 164 KB
/
function.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
function user_list(){
global $link;
$main="
<br>
<br>
<br>
<!--頁籤開始
只需要在加上tabs-left可將標籤放在左邊,tabs-below標籤在底下,tabs-right標籤在右邊-->
<!--頁籤結束-->
<!---加入各種通知開始-->
<!-- Nav tabs -->
<!-- Tab panes -->
<div>
<div class='alert alert-success' role='alert'>
<h2 class='alert-heading' style='text-align:center' ><span style='font-family:Microsoft JhengHei;'><b>Welcome to <span style='font-family:Microsoft JhengHei;'>省電大作戰 !</span></b></span></h2>
<br><br>
<ol>
<li type=none>
<span style='font-size:26px'><span style='font-family:Microsoft JhengHei;'><span class='glyphicon glyphicon-arrow-left' aria-hidden='true'></span> 點選左方<b>『單一推薦電器』</b><br>選擇想要的電器開始推薦 !</span></span>
</li>
<br>
<li type=none >
<span style='font-size:26px'><span style='font-family:Microsoft JhengHei;'>想要體驗更多功能?<br><span class='glyphicon glyphicon-arrow-right' aria-hidden='true'></span><b><a href='{$_SERVER["PHP_SELF"]}?op=register'> 點我註冊</a></b><br>
<span class='glyphicon glyphicon-arrow-right' aria-hidden='true'></span><b><a href='{$_SERVER["PHP_SELF"]}?op=user_login'> 點我登入</a></b><br>登入後開始體驗更多功能 !</span></span>
</li>
</ol>
<hr>
</div>
</div>
";
return $main;
}
function user_list_login(){
global $link;
$main="
<br>
<!--頁籤開始
只需要在加上tabs-left可將標籤放在左邊,tabs-below標籤在底下,tabs-right標籤在右邊-->
<!--頁籤結束-->
<!---加入各種通知開始-->
<!-- Nav tabs -->
<ul class='nav nav-tabs' role='tablist'>
<li role='presentation' class='active'><a href='#home' aria-controls='home' role='tab' data-toggle='tab'>首頁</a></li>
<li role='presentation'><a href='#profile' aria-controls='profile' role='tab' data-toggle='tab'>Q&A</a></li>
</ul>
<!-- Tab panes -->
<div class='tab-content'>
<div role='tabpanel' class='tab-pane active' id='home'>
<br>
<div class='alert alert-success' role='alert'>
<h2 class='alert-heading' style='text-align:center' ><span style='font-family:Microsoft JhengHei;'><b>Welcome to <span style='font-family:Microsoft JhengHei;'>省電大作戰 !</span></b></span></h2>
<br><br>
<ol>
<li type=none>
<span style='font-size:26px'><span style='font-family:Microsoft JhengHei;'><span class='glyphicon glyphicon-arrow-left' aria-hidden='true'></span> 點選左方<b>『單一推薦電器』</b><br>選擇想要的電器開始推薦 !</span></span>
</li>
<br>
<li type=none >
<span style='font-size:26px'><span style='font-family:Microsoft JhengHei;'><span class='glyphicon glyphicon-arrow-left' aria-hidden='true'></span> 點選左方<b>『組合電器推薦』</b><br>一次給您統整性的組合推薦 !<br></span></span>
</li>
<br>
<li type=none >
<span style='font-size:26px'><span style='font-family:Microsoft JhengHei;'>想要了解每月您使用的用電量嗎?<br><span class='glyphicon glyphicon-arrow-right' aria-hidden='true'></span> <b><a href='{$_SERVER["PHP_SELF"]}?op=add_user_form'>點選我開始填寫表單</a></b><br><br>填完表單後就可以開始使用圖表分析的功能啦 !<br>
<span class='glyphicon glyphicon-arrow-left' aria-hidden='true'></span> 點選左方<b>『每月用電統計』</b><br>
<span class='glyphicon glyphicon-hand-right' aria-hidden='true'></span> 點選<b>『<a href='{$_SERVER["PHP_SELF"]}?op=chart''>用電時數比例</a>』</b>/ 查看每月電器使用時數<br>
<span class='glyphicon glyphicon-hand-right' aria-hidden='true'></span> 點選<b>『<a href='{$_SERVER["PHP_SELF"]}?op=chart2''>電費價格比例</a>』</b>/ 查看每月電器使用電費<br>
<span class='glyphicon glyphicon-hand-right' aria-hidden='true'></span> 點選<b>『<a href='{$_SERVER["PHP_SELF"]}?op=chart3''>年度用電表</a>』</b>/ 查看年度統整表<br>
</span></span>
</li>
</ol>
<hr>
</div>
</div>
<div role='tabpanel' class='tab-pane' id='profile'>
<br>
<div class='alert alert-info' role='alert'>
<h2 class='alert-heading' style='text-align:center'><span style='font-family:Microsoft JhengHei;'><b>Q1: 想省電卻不知道從何下手?</b></span></h2>
<br><br>
<h4 style='margin-left:23px' ><span style='font-family:Microsoft JhengHei;'>每月用電統計</span></h4>
<ol style='font-size:18px' >
<span style='font-family:Microsoft JhengHei;'>
<li type=disc>
填寫用電基本資料
<ul>
了解當月用電統計
</ul>
<ul>
電費價格
</ul>
<ul>
從用電量百分比中控管相應電器使用量
</ul>
</li>
<li type=disc>
經年累月
<ul>
了解整年月用電分布
</ul>
<ul>
夏月即非夏月的差別
</ul>
<ul>
以年為單位做到更精密的分析
</ul>
</li>
</span>
</ol>
<hr>
</div>
<div class='alert alert-danger' role='alert'>
<h2 class='alert-heading' style='text-align:center'><span style='font-family:Microsoft JhengHei;'><b>Q2: 想省荷包或為家裡的電費感到頭痛?</b></span></h2>
<br><br>
<h4 style='margin-left:23px' ><span style='font-family:Microsoft JhengHei;'>組合電器推薦</span></h4>
<span style='font-family:Microsoft JhengHei;'>
<ol style='font-size:18px'>
<li type=disc>
勾選需要的電器項目
<ul>
因應電器選擇需要的條件
</ul>
<ul>
推薦你完美的省電家具組合
</ul>
</li>
<br>
</ol><h4 style='margin-left:23px' ><span style='font-family:Microsoft JhengHei;'>單一電器推建<span></h4>
<ol style='font-size:18px'>
<li type=disc>
勾選需要的電器項目
<ul>
因應電器選擇需要的條件
</ul>
<ul>
推薦符合使用者需求且性價比較高者
</ul>
</li>
</ol>
</span>
<hr>
</div>
</div>
</div>
";
return $main;
}
function user_login(){
global $link;
$sql3="select * from `user_idpw` where user_id='{$_POST['user_id']}' and user_password='{$_POST['user_password']}'";
$result=mysqli_query($link,$sql3)or die_content(mysql_error($link)."檢索資料失敗");
$num=mysqli_num_rows($result);
if($num==0)
{
die_content("此ID未被註冊,快來註冊吧~ <a href='{$_SERVER["PHP_SELF"]}?op=register'>Register here!</a>");
}
else
{
$_SESSION['user_id']=$_POST['user_id'];
}
}
function register_user(){
global $link;
if($_POST['user_pwd_con']==$_POST['user_password']){
$sql3="select `user_id` from `user_idpw` where user_id='{$_POST['user_id2']}'";
$result=mysqli_query($link,$sql3)or die_content(mysql_error($link)."檢索資料失敗");
$num=mysqli_num_rows($result);
if($num>0)
{
$main="<script>alert('此ID已被註冊,請重新填寫');location.href='{$_SERVER["PHP_SELF"]}?op=register';</script>";
echo $main;
}
else
{
$sql2="insert into `user_idpw`(
`user_id`,`user_password`)
values('{$_POST['user_id2']}','{$_POST['user_password']}')";
mysqli_query($link,$sql2)or die_content(mysql_error($link)."註冊失敗");
$_SESSION['user_id']=$_POST['user_id2'];
//die_content("註冊成功,歡迎來到<a href='{$_SERVER["PHP_SELF"]}'><span class='glyphicon glyphicon-leaf' aria-hidden='true'>省電大作戰</a>");
$main="<script>alert('註冊成功,歡迎來到省電大作戰');location.href='{$_SERVER["PHP_SELF"]}';</script>";
echo $main;
}
}
else{
$main="<script>alert('密碼輸入有誤,請重新輸入');location.href='{$_SERVER["PHP_SELF"]}?op=register';</script>";
echo $main;
}
}
function search_main(){
global $link;
$main="
<div>
<!-- Nav tabs -->
<ul class='nav nav-tabs' role='tablist'>
<li role='presentation' class='active'><a href='#home' aria-controls='home' role='tab' data-toggle='tab'>我的單一家用電器</a></li>
</ul>
<!-- Tab panes -->
<div class='tab-content'>
<div role='tabpanel' class='tab-pane active' id='home'>
<form class='form-horizontal' role='form' action ='{$_SERVER['PHP_SELF']}' method='post' >
<fieldset data-role='controlgroup' >
<!-- Form Name -->
<h3>請輸入所需電器:</h3>
<label for='electricAppliances' ></label>
<input type='hidden' name='op' value='search_main'>
<!-- Text input-->
<br>
<div class='form-group' >
<label class='col-sm-1 control-label' for='textinput'> </label>
<div class='col-sm-1'>
<input type='checkbox' style='zoom:250%' id='refrigerator' name='electricAppliances[]' value='refrigerator'>
</div>
<p style='font-size:20px' style='vertical-align:baseline' class='col-sm-2 control-label' ><strong> 冰      箱</strong> </p>
<label class='col-sm-1 control-label' for='textinput'> </label>
<div class='col-sm-1'>
<input type='checkbox' style='zoom:250%' id='washer' name='electricAppliances[]' value='washer'>
</div>
<p style='font-size:20px' style='vertical-align:baseline' class='col-sm-2 control-label' ><strong> 洗 衣 機</strong></p>
</div>
<!-- Text input-->
<div class='form-group'>
</div>
<!-- Text input-->
<div class='form-group'>
<label class='col-sm-1 control-label' for='textinput'> </label>
<div class='col-sm-1'>
<input type='checkbox'style='zoom:250%' id='dehumidifier' name='electricAppliances[]' value='dehumidifier'>
</div>
<p style='font-size:20px' style='vertical-align:baseline' class='col-sm-2 control-label' ><strong> 除 濕 機</strong> </p>
<label class='col-sm-1 control-label' for='textinput'> </label>
<div class='col-sm-1'>
<input type='checkbox' style='zoom:250%' id='electric_pot' name='electricAppliances[]' value='electric_pot'>
</div>
<p style='font-size:20px' style='vertical-align:bottom' class='col-sm-3 control-label' ><strong> 電 鍋 / 電子 鍋</strong> </p>
</div>
<!-- Text input-->
<div class='form-group'>
<label class='col-sm-1 control-label' for='textinput'> </label>
</div>
<div class='form-group'>
<div class='col-sm-offset-2 col-sm-10'>
<div class='pull-right'>
<button type='submit' name='submit' style='zoom:125%' class='btn btn-primary'>確認</button>
</div>
</div>
</div>
</form>
<hr>
";
$main.=cho();
$main.=sql();
$main.="</div></div>";
return $main;
}
function search_sec(){
global $link;
$main="
<div>
<!-- Nav tabs -->
<ul class='nav nav-tabs' role='tablist'>
<li role='presentation' class='active'><a href='#home' aria-controls='home' role='tab' data-toggle='tab'>我的房間電器</a></li>
</ul>
<!-- Tab panes -->
<div class='tab-content'>
<div role='tabpanel' class='tab-pane active' id='home'>
<div><br><label class='col-sm-3 control-label' for='extinput'></label></div>
<div class='form-group'>
<b><a href='{$_SERVER['PHP_SELF']}?op=search_sec2&room=1'>room1</a> </b>
<b><a href='{$_SERVER['PHP_SELF']}?op=search_sec2&room=2'>room2</a> </b>
<b><a href='{$_SERVER['PHP_SELF']}?op=search_sec2&room=3'>room3</a> </b>
<b><a href='{$_SERVER['PHP_SELF']}?op=search_sec2&room=4'>room4</a> </b>
<b><a href='{$_SERVER['PHP_SELF']}?op=search_sec2&room=5'>room5</a> </b>
</div>
<form class='form-horizontal' role='form' action ='{$_SERVER['PHP_SELF']}' method='post' >
<fieldset data-role='controlgroup' >
<!-- Form Name -->
<h3>請輸入 room".$_SESSION['room']." 所需電器:</h3>
<label for='electricAppliances' ></label>
<input type='hidden' name='op' value='search_sec2'>
<!-- Text input-->
<br>
<div class='form-group' >
<label class='col-sm-1 control-label' for='textinput'> </label>
<div class='col-sm-1'>
<input type='checkbox' style='zoom:250%' id='tv' name='electricAppliances[]' value='tv'>
</div>
<p style='font-size:20px' style='vertical-align:baseline' class='col-sm-2 control-label' ><strong> 電      視</strong> </p>
<label class='col-sm-1 control-label' for='textinput'> </label>
<div class='col-sm-1'>
<input type='checkbox' style='zoom:250%' id='airConditioner' name='electricAppliances[]' value='airConditioner'>
</div>
<p style='font-size:20px' style='vertical-align:baseline' class='col-sm-2 control-label' ><strong> 冷 氣 機</strong></p>
</div>
<!-- Text input-->
<div class='form-group'>
<label class='col-sm-1 control-label' for='textinput'> </label>
</div>
<div class='form-group'>
<div class='col-sm-offset-2 col-sm-10'>
<div class='pull-right'>
<button type='submit' name='submit' style='zoom:125%' class='btn btn-primary'>確認</button>
</div>
</div>
</div>
</form>
<hr>
";
$main.=inputCondition();
$main.=sqlA();
$main.="</div></div>";
return $main;
}
function search_final(){
global $link;
$main="
<div>
<!-- Nav tabs -->
<ul class='nav nav-tabs' role='tablist'>
<li role='presentation' class='active'><a href='#home' aria-controls='home' role='tab' data-toggle='tab'>綜合電器列表</a></li>
<li role='presentation'><a href='#profile' aria-controls='home' role='tab' data-toggle='tab'>我的房間電器列表</a></li>
<li role='presentation'><a href='#last' aria-controls='home' role='tab' data-toggle='tab'>我的單一家用電器列表</a></li>
</ul>
<!-- Tab panes -->
<div class='tab-content'>
<div role='tabpanel' class='tab-pane active' id='home'>";
//room0
$main.= "<br><div class='alert alert-info' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>我的電器</b></span></h2><hr>";
$sql="Select `washerCapacityName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='0'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$washerCapacityName=$row['washerCapacityName'];
if($washerCapacityName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `washer` where `容量`<$washerCapacityName && `容量`>=($washerCapacityName-2) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的洗衣機:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['商品型號']}'>";
$main.= "商品型號: ". $row["商品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 容量: ". $row["容量"]."</a><br> ";
} $main.= "</div>";
}
}
$sql="Select `refrigeratorCapacityName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='0'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$refrigeratorCapacityName=$row['refrigeratorCapacityName'];
if($refrigeratorCapacityName!=NULL){
$refrigeratorCapacityName=intval($refrigeratorCapacityName);
$sql="select * from `新冰箱` where `容量`<$refrigeratorCapacityName && `容量`>=($refrigeratorCapacityName-100) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冰箱:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 容量: ". $row["容量"]."</a><br> ";
} $main.= "</div>";
}
}
$sql="Select `areaName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='0'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$areaName=$row['areaName'];
//die_content($areaName);
if($areaName!=NULL){
$sql="select * from `dehumidifier` where `除濕機等級`=$areaName order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的除濕機:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 能源等級: ". $row["能源等級"]." 除濕能力: ". $row["除濕能力"]." 除濕機等級: ". $row["除濕機等級"]."</a><br> ";
} $main.= "</div>";
}
}
$sql="Select `needName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='0'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$needName=$row['needName'];
if($needName!=NULL&&$needName!=0){
$needName=intval($needName);
$sql="select * from `電鍋` order by `能源等級` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電鍋電子鍋:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["耗電量"]." 能源等級: ". $row["能源等級"]."</a><br> ";
} $main.= "</div>";
}
}
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 1</b></span></h2><hr>";
//room1
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='1'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='1'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='1'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
//room2
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 2</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='2'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='2'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='2'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
//room3
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 3</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='3'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='3'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='3'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
//room4
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 4</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='4'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='4'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='4'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
//room5
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 5</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='5'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='5'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:</b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='5'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
$main.="</div>";
$main.="<hr>";
$main.="</div>
<div role='tabpanel' class='tab-pane' id='profile'>
<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 1</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='1'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='1'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='1'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
//room2
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 2</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='2'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='2'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='2'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
//room3
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 3</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='3'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='3'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='3'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
//room4
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 4</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='4'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='4'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='4'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
//room5
$main.="</div>";
$main.= "<br><div class='alert alert-warning' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>Room 5</b></span></h2><hr>";
$sql="Select `sun` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='5'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$sun=$row['sun'];
$sql="Select `roomSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='5'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$roomSizeName=$row['roomSizeName'];
if($sun!=NULL&&$roomSizeName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);
$sql="select * from `冷氣` where `冷氣能力`>=($roomSizeName*$sun) && `冷氣能力`>=(($roomSizeName-1)*$sun) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的冷氣:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 冷氣能力: ". $row["冷氣能力"]."</a><br> ";
} $main.="</div>";
}
}
$sql="Select `tvSizeName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='5'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$tvSizeName=$row['tvSizeName'];
if($tvSizeName!=NULL){
$tvSizeName=intval($tvSizeName);
$sql="select * from `tv` where `尺寸`<=$tvSizeName && `尺寸`>($tvSizeName-10) order by `能源效率` DESC limit 0,5";
$result = mysqli_query($link,$sql);
if ($result->num_rows > 0)
{
// 輸出每行數據
$main.= "<div class='alert' role='alert' style='background-color:white; color:black;'><b>以下為推薦您的電視:<h5 style='font-family:Microsoft JhengHei;'>(能源效率數值越大表示越省電喔!)</h5></b><hr>";
while($row = mysqli_fetch_assoc($result))
{
$main.= "<a target='_new' style='color:black;' href='https://feebee.com.tw/s/?q={$row['產品型號']}'>";
$main.= "商品型號: ". $row["產品型號"]. " 商標名稱: ". $row["商標名稱"]." 能源效率: ". $row["能源效率"]." 年耗電量: ". $row["年耗電量"]." 尺寸: ". $row["尺寸"]."</a><br> ";
}$main.="</div>";
}
}
$main.="</div>";
$main.="</div>
<div role='tabpanel' class='tab-pane' id='last'>";
//room0
$main.= "<br><div class='alert alert-info' role='alert'>
<h2 class='alert-heading' style='text-align:left'><span style='font-family:Microsoft JhengHei;'><b>我的電器</b></span></h2><hr>";
$sql="Select `washerCapacityName` from `records` where `user_id` like '{$_SESSION['user_id']}' && `roomtype`='0'";
$result=mysqli_query($link,$sql);
$row=mysqli_fetch_assoc($result);
$washerCapacityName=$row['washerCapacityName'];
if($washerCapacityName!=NULL){
//$sun=intval($sun);
//$roomSizeName=intval($roomSizeName);