Created
March 24, 2016 17:20
-
-
Save jeffstephens/9ddcd03d8114e3ba296a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class MachineDescription { | |
public $name, $type; | |
public function __construct($name, $type) { | |
$this->name = $name; | |
$this->type = $type; | |
} | |
} | |
$query_result = mysqli_query(); // whatever you need to query | |
$machines = []; | |
foreach($row in mysqli_fetch_assoc($query_result)) { | |
$machines[] = new MachineDescription($row['name'], $row['type']); | |
} | |
return json_encode($machines); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment