All pastes #912284 Raw Edit

Someone

public text v1 · immutable
·published 2008-02-21 07:25 UTC
rendered paste body
// Pull Information: MySQL
#$queryString = "SELECT id, notifyType, time, text FROM pvp_notifications WHERE userid='" . $this->User->getClassVar('userID') . "' AND username='" . $this->User->getClassVar('username') . "' AND time > '0' ORDER BY id DESC LIMIT " . $this->User->getUserData('rowsPerPage');
$query = $this->db->query("SELECT id, notifyType, time, text FROM pvp_notifications WHERE userid='3' AND username='testbot' AND time > '0' ORDER BY id DESC LIMIT 10");

echo $queryString . "<br />";
echo $query->num_rows;

// If Number of Result Rows, is Less than one, then no notifications exist.
if ($query->num_rows() < 1) {
	$thisDay = $this->general->makeDate($this->general->getCurTime(), $this->User->getUserData('timeZone'));
	echo "<div id='notifyHeader'><b>" . $thisDay . "</b></div>";
	echo "<div id='notifyText' style='background: #1b1b1b; text-align: center;'><b>No Notifications</b></div>";
} else { // Else Loop into array and print.

	foreach ($query->result_array() as $row) {
	        
	        // Determines the BGColor Hex Code
		if ($i % 2 == 0) {
			$BGColor = "232323";
		} else {
			$BGColor = "1b1b1b";
		}
		
		// Set Time Variables
		$notDay = $this->general->getDay($row['time'], $this->User->getUserData('timeZone'));
		$notTime = $this->general->makeDate($row['time'], $this->User->getUserData('timeZone'));

                // If Emtpy, then new time.
		if (empty($curDay) || $curDay != $notDay) {
			$curDay = $notDay;
			$curYear = $notYear;
			echo"<div id='notifyHeader'><b>" . $notTime . "</b></div>";
		}
	
		// Print Information
		echo"<div id='notifyText' style='background: #" . $BGColor . ";'>";
		echo"<span style='float: left;'><b>" . $this->Notifications->getType($row['type']) . "</b>: " . $row['text'] . "</span>";
		echo"<span style='float: right; padding-right: 5px;'><a class=\"delNotification\" id=\"" . $row['id'] . "\" href=\"#\"><img src='" . base_url() . "images/delNotify.jpg' alt='X' width='20' height='18' border='0' /></a></span></div>";
		
		// ++
		$i++;
	}
}