I have two classes. UserModel and UserController.
file: localhost/controllers/user.controller.php
<?php
class UserController
{
public function GetArray() {
$query = 'SELECT id, username, email, password FROM Users';
$result = mysql_query($query);
$model = new UserModel();
while ($row = mysql_fetch_array($result)) {
$model->id = $row['id'];
$model->username = $row['username'];
$model->email = $row['email'];
$model->password = $row['password'];
$array[] = $model;
}
return $array;
}
}
?>
The UserModel class is in another file: localhost/models/user.model.php. The 6th row is causing the error, because there’s no references to the other file. How can I do that?
Sorry for my bad english, and thanks to you all.
Use require or require_once to include the other file.