All pastes #589442 Raw Edit

k4st

public php v1 · immutable
#589442 ·published 2007-06-26 00:03 UTC
rendered paste body
<?phprequire_once APPPATH .'/libraries/ActiveRecords/controller.php';class Ar extends ActiveController {	public function index() {				// using active records				echo 'AR<hr />';				// get the 'it' tag		$tag = $this->getFinder('tags')->find(1);				foreach($tag->job_posts as $job) {			echo $job->Id .': '. $job->EmployerName .', '. $job->Id .': '. $job->Title .'<br />';		}						// no using active records				echo '<br><br>Not-AR<hr />';				$this->db->select("		          JobPostings.Id, JobPostings.EmployerName, JobPostings.Instructions, JobPostings.ClickThroughUrl, JobPostings.ContentId, JobPostings.Alternate,             Content.Title, Content.IsDeleted, Content.IsApproved, Content.IsRejected, Content.IsPaidFor, Content.IsPublic, Content.DateCreated,            Content.DateUpdated, Content.DateExpired        ");        $this->db->from("JobPostings");        $this->db->join("Content", "JobPostings.ContentId = Content.Id");        $this->db->join("ContentTags", "Content.Id = ContentTags.ContentId");        $this->db->join("Tags", "ContentTags.TagId = Tags.Id");        $this->db->where("Tags.Id", 1);		$result = $this->db->get();				foreach($result->result_array() as $row) {			echo $row['Id'] .': '. $row['EmployerName'] .', '. $row['Id'] .': '. $row['Title'] .'<br />';		}	}}