Location: PHPKode > scripts > PHPDBX > phpdbxa1/phpdbx/dbgrids.php
<?
	class TDbGridColumn
	{
		var $FieldName;
		var $Style;
		var $Title;
		var $TitleStyle;
		var $Width;
	}

	class TDBGrid
	{
		var $Query;
		var $Columns;
		var $DefaultColumns;
		var $Style;
		var $TitleStyle;
		var $PartRows;
		var $Width;
		
		function Display() 
		{

			echo '<table>';				
			
			if ($this->DefaultColumns == FALSE)
			{
				
				echo '<tr>';
					for ($i=0; $i<$this->Query->Col; $i++)
					{
						if ( $this->Columns[$i]->Width == 0 ) $lat = $this->Width;
							else $lat = $this->Columns[$i]->Width;
						if ( $this->Columns[$i]->TitleStyle == '' ) $clas = $this->TitleStyle;
							else $clas = $this->Columns[$i]->TitleStyle;
						echo'<td class='.$clas.' width='.$lat.'>'; echo $this->Columns[$i]->Title; echo'</td>';
					}
				echo '</tr>';
				$con=0;
				while ( ! $this->Query->Eof )
				{
					$this->Query->Next();
					if ( $con < $this->PartRows || $this->PartRows == 0 )
					{
			 			echo '<tr>';
							for ($i=0; $i<$this->Query->Col; $i++)
							{
								if ( $this->Columns[$i]->Style == '' ) $clas = $this->Style;
									else $clas = $this->Columns[$i]->Style;
									
								if ($this->Query->ObjectField == FALSE)
									echo '<td class='.$clas.'>'.$this->Query->Field[$i].'</td>';
									
								if ($this->Query->ObjectField == TRUE)
								{
									$this -> Query -> InfoRows ($i);									
									$name = $this->Query->Info['name'];									
									echo '<td class='.$clas.'>'.$this->Query->Field->$name.'</td>';
								}
							}
							$con++;			
						echo '</tr>';
					}					
				}
			 }
			 $rin = 0;
			 if ( $this->DefaultColumns == TRUE )
			 {					
				while ( ! $this->Query->Eof )
				{
					$this->Query->Next();
					if ($rin==0)
					{
						for ($i=0; $i<$this->Query->Col; $i++)
						{
							$this -> Query -> InfoRows ($i);							
							echo'<td class='.$this->TitleStyle.' width='.$this->Width.'>'.$this->Query->Info['name'].'</td>';
						}
						$rin = 1;
					}
					echo '<tr>';
							for ($i=0; $i<$this->Query->Col; $i++)
							{
								if ($this->Query->ObjectField == FALSE)
									echo '<td class='.$this->Style.'>'.$this->Query->Field[$i].'</td>';
								
								if ($this->Query->ObjectField == TRUE)
								{
									$this -> Query -> InfoRows ($i);
									$name = $this->Query->Info['name'];
									echo '<td class='.$this->Style.'>'.$this->Query->Field->$name.'</td>';
								}
							}
					echo '</tr>';
				}
			 }
    		echo '</table>';
		}
	}
?>
Return current item: PHPDBX