Welcome Guest, Not a member yet? Register   Sign In
Error require_once
#1

[eluser]iConTM[/eluser]
Hi,

I want to require a class for the model below.

The goal of this class is to store translated data from the database before it is passed to the view. (e.g. htmlspecialchars ect.)

Is this a good practice?



<?php

require_once APPPATH . 'models/add.php';

class Advertisement extends Model {

function Advertisement() {
parent::Model();
}

function get () {

$query = $this->db->query("SELECT * FROM advertising ORDER BY name ASC;");

$adds = array();

foreach ($query->result() as $row) {

$add = new Add();
$add->id = $row->id;
$add->name = htmlspecialchars($row->name);
$add->link = $row->link;
$add->image = $row->image;
$add->hits = $row->hits;
$add->firstdate = $row->firstdate;
$add->imagepresent = $row->imagepresent;
$add->listed = $row->listed;
$add->impressions = $row->impressions;

$adds[] = $add;

}

return $adds;

}

}

/* End of file advertisement.php */
/* Location: ./system/application/models/advertisement.php */


Messages In This Thread
Error require_once - by El Forum - 06-01-2010, 03:38 PM
Error require_once - by El Forum - 06-01-2010, 08:04 PM
Error require_once - by El Forum - 06-01-2010, 09:32 PM
Error require_once - by El Forum - 06-02-2010, 08:49 AM
Error require_once - by El Forum - 06-02-2010, 10:41 AM
Error require_once - by El Forum - 06-02-2010, 11:24 AM
Error require_once - by El Forum - 06-02-2010, 12:07 PM
Error require_once - by El Forum - 06-02-2010, 03:40 PM



Theme © iAndrew 2016 - Forum software by © MyBB