On 22-09-2012 16:19, Samuel Lopes Grigolato wrote:
+1 to bad maintainability of the code.
As a suggestion, one better solution could be something like:
[...]
class Entity {
public $id;
public $name;
}
[...]
$entity = new Entity();
foreach [...]
$entity->$$key = $value;
[...]
And, of course, never ever use "*" in SQL queries.
Samuel.
If you're doing it that way, just use mysqli and then mysqli_result's
fetch_object with your Entity as the class. ie:
$result = $mysqli->query('some query');
$entity = $result->fetch_object('Entity');
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php