All pastes #754613 Raw Edit

Stuff

public text v1 · immutable
#754613 ·published 2007-10-30 03:11 UTC
rendered paste body
<?php
	class Events extends Zend_Db_Table {
		protected $_name = 'stEvents';
		protected $_primary = 'eventid';
		
		protected $MethodsModel;
		protected $database;
		
		function Events() {	
			$this->database     = Zend_Registry::get('db');	
			$this->MethodsModel = Zend_Loader::loadClass('Methods');
		}
		
		function AddEvent($ArtistID, $ZipCode, $UnixTime, $VenueName, $PurchaseURL = '') {
			if (!$this->CheckForDuplicateEvent($ArtistID, $UnixTime)) {
				$insertData = array('artistid' => $ArtistID,
									'date'     => $UnixTime,
									'venue'    => $VenueName,
									'purchase' => $PurchaseURL);
				$this->insert($insertData);
				die('okay?');
			}
		}
		
		function CheckForDuplicateEvent($ArtistID, $UnixTime) {
			$SelectQuery = $this->database->select()
								->from($this->_name, array('eventid'))
								->where('artistid = ?', $ArtistID)
								->where('date = ?', $UnixTime);
								
			$RunQuery     = $this->database->query($SelectQuery);
			$ExecuteQuery = $RunQuery->fetchAll();
			if (count($ExecuteQuery) > 0) { return false; } else { return true; }
		}
		
	}