On portfolio page, oop_adv_calc.php, must we also use mySql? The tutorial letter says that we must use the knowledge gained from
step 7.
Tutorial Letter 102
Step 7: Create a database on the server, and add three tables. The 1st table is named model, the 2nd table is named colour, and the 3rd table is named availability.
Another problem that I have is that when I use the class with the constructor, my calculator does not work and when I remove the function ___construct it works. Is it fine if I use the class without the constructor?
Example code:
Language: PHP
<?php
// Defines the class Calculator
class Calculator {
// variables for value 1 input and value 2 input
private $val1, $val2;
// public function to add value1 and value2
public function add($val1,$val2){
$result = $val1 + $val2;
// message to display after calculation
echo("The sum of $val1 and $val2 is $result<br><br>");
echo("$val1 + $val2 = $result");
}