Yii Framework Forum: How To Get Data From Database - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How To Get Data From Database Rate Topic: -----

#1 User is offline   nosthertus 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 64
  • Joined: 14-September 13

Posted 20 September 2013 - 05:34 PM

hey guys, im new to programming and i wanted to start with yii.. what im trying to do is to get a data from database and i was watching tutorials on how to use yii. but im not clear about getting an specific data from a table in the database.. i googled on php about getting the data and i tried bunch of the ways but not clue how to get it.. this is my controller

<?php
class ReporteController extends Controller
{
	//Direccion del diseno
	public $layout='//reporte/layouts/column1';

	public function actionIndex()
	{
		//se implementa la libreria PDF para generar la pagina en PDF
		$mPDF1 = Yii::app()->ePdf->mpdf();

		//Se incluye el diseno css en el archivo pdf
		$stylesheet = file_get_contents(Yii::getPathOfAlias('webroot.css') . '/reporte/presentacion.css');
		$stylesheet = file_get_contents(Yii::getPathOfAlias('webroot.css') . '/reporte/header_hidro.css');
		$mPDF1->WriteHTML($stylesheet, 1);

		/*
		*	Creando el contenido de la pagina PDF
		*/

		$mPDF1->SetHTMLHeader($this->render('header',array(), true));
		$mPDF1->WriteHTML(CHtml::image(Yii::getPathOfAlias('webroot.css') . '/reporte/hidrolab_logo.jpg'));
		$mPDF1->WriteHTML($this->render('presentacioncot', array('nombre'=>$nombre, 'direccion'=>$direccion), true));
		$mPDF1->AddPage();
		$mPDF1->WriteHTML($this->render('presentacioncot', array(), true));
		$mPDF1->OutPut();
				
		//$this->render('presentacioncot', array('reporte'=>$reporte));

	}

}


and this is my view:

<html>



<p div align='right'> <?php echo date('d-F-Y')?> <?php echo $direccion; ?></p>  

<p>Señores:</p>
<p class="izquierda"><b><?php echo $nombre;?></b></p>
<p class="izquierda"><?php echo $direccion; ?></a>



<p class="derecha">Atn: <?php echo $contacto; ?></p>
<p class="derecha">Ref:'Iniciales de la empresa'-'N° de departamento'-'N° de contizacion para esta empresa'-'año'</p>

<p>Estimados Señores:</p>

<p>Por medio de la presente nos es grato dirigirnos a Uds., para presentarles nuestra mejor <b>CONTRATO OFERTA </b>por los servicios 'SERVICIOS' de sus Instalaciones ubicadas en <?php echo $direccion; ?>. </p>

<p>Cabe a destacar que nuestro laboratorio esta registrado ante 'organizacion'.</p>

<p>Sin otro particular a que hacer referencia y quedando a la orden para cualquier aclaratoria adicional, nos suscribimos de ustedes.</p>

<p class="centro">Atentamente</p>
<p class="centro">Por, <b>HIDROLAB TORO CONSULTORES C.A</b></p>
<p style="text-align:center">'Coordinador de agua y desechos'||'Jefe del departamento de Ventas'</p>


</html>


it might seem to be uncomplete and its because of many times of tries.. please tell me how to get data from database

example: get nombre from table cotizacion
0

#2 User is offline   nineinchnick 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 622
  • Joined: 12-September 11
  • Location:Bialystok, Poland

Posted 21 September 2013 - 03:27 AM

Please read the tutorial about reading ActiveRecord.
Don't be a dick.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users