· 8 years ago · May 30, 2018, 06:56 AM
1CREATE TABLE IF NOT EXISTS `student_prices` (
2 `id` int(10) NOT NULL AUTO_INCREMENT,
3 `morning` decimal(10,2) NOT NULL,
4 `afternoon` decimal(10,2) NOT NULL,
5 `all_day` decimal(10,2) NOT NULL,
6 PRIMARY KEY (`id`)
7) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=3 ;
8
9--
10-- Dumping data for table `student_prices`
11--
12
13INSERT INTO `student_prices` (`id`, `morning`, `afternoon`, `all_day`) VALUES
14(1, 12.50, 12.50, 22.50),
15(2, 22.50, 22.50, 32.50);
16
17
18// Jason's code
19$price = 0;
20if ($day_type == 'All Day' | $day_type == 'Video Only') {
21 $price = 45;
22} else {
23 $price = 25;
24}
25// Students get 50% Off
26if ($student == 'Yes')
27 $price = $price / 2;
28
29if ($membership == 'Non-Member')
30 $price += 30;
31// End
32
33
34
35if(($day_type!="All Day" && $day_type!="Video Only") && $student=="Yes")
36 {
37 $price="12.50";
38 }
39 else if (($day_type=="All Day" || $day_type=="Video Only") && $student=="Yes")
40 {
41 $price="22.50";
42 }
43 else if (($day_type!="All Day" && $day_type!="Video Only") && $student=="No")
44 {
45 $price="25.00";
46 }
47 else if (($day_type=="All Day" || $day_type=="Video Only") && $student=="No")
48 {
49 $price="45.00";
50 }
51
52 if($membership=='Non-Member')
53 {
54 $price=$price+30;
55 }
56
57 if ($price!=0)
58 {
59 echo "$".number_format($price,2)." for the ".$day_type." session.";
60 }