Jump to content

claudiaraquelcp

New Members
  • Posts

    1
  • Joined

  • Last visited

Everything posted by claudiaraquelcp

  1. Hi, if i have a class named “employeer” with some attributes: id, name, age, job, salary and admission_date. This class can have a method that calls database with MYSQL? This is the code: <?php class employeer { public id; public name; public age; public job; public salary; public admission_date; public id_employee; public description; public value; public status; public delivery_date; public function getId() { return $this->id; } public function setId($id) { $this->id = $id; } public function getName() { return $this->name; } public function setName($name) { $this->name = $name; } public function getEmployersJobs() { $conn = mysqli_connect("localhost", "my_user", "my_password", "staff"); $results = array(); $dob_array = mysqli_query($conn, "SELECT job FROM employees"); while($row = mysqli_fetch_assoc($dob_array)){ $results[] = $row; } return $results; } } ?> Does the method getEmployersJobs() is well implemented?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.