PostgreSQL - filtrar fechas con substr

 
Vista:

filtrar fechas con substr

Publicado por alejon (1 intervención) el 11/08/2011 18:40:09
tengo un problema para filtrar de una bse de datos de postgres pero no lo imprime
lo envio de esta manera:
PRIMER CODIGO

<td><input type="text" size=10 maxlength=10 name="fechad"

y con POST le envio a este codigo:
<?php
$conexion = pg_connect("host=localhost port=5432 dbname=administra user=postgres password=/*parW");
//$fecha = substr($_POST['fechad'],0,2).'-'.substr($_POST['fechad'],3,2).'-'.substr($_POST['fechad'],6,4);
$mes = substr($_POST['fechad'],5,2);
$resultado = "SELECT * FROM public.ingresos WHERE substring(ingresos.fecha,5,2) = $mes";
require('WriteTag.php');
class PDF extends PDF_WriteTag
{
//Cabecera de página
function Header()
{
//Logo
/*$this->Image('archivo',x,y,w,h);*/
//$this->Image('imagenes/dibujo.JPG',55,10,100,20);
$this->Ln(20);
$this->SetFont('Times', '', 10);
$this->Ln(2);
$this->Cell(110, 10, 'Listado de Ingresos', 0, 0, 'C');
$this->Cell(70, 5, 'Fecha: '.date('d/m/Y'), 0, 1, 'R');
$this->Ln(4);
$this->Cell(22,10,"Descripcion",0,0,'L');
$this->Cell(65,10,"Monto",0,1,'R');
$this->Line($this->GetX(), $this->GetY(), 200, $this->GetY());
//Arial bold 15
$this->SetFont('Arial','B',8);
$this->Ln(8);
}
//Pie de página
function Footer()
{
//Posición: a 1,5 cm del final
$this->SetY(-20);
//Arial italic 8
$this->SetFont('Arial','I',8);
//Número de página
$this->Cell(0,10,'Pag '.$this->PageNo(),0,0,'C');
}
}
//--Fin de la Clase
//Creación del objeto de la clase heredada
$pdf=new PDF('P','mm','Letter');
$pdf->Ln(4);
$pdf->SetFillColor(200);
$contador = 0;
$lisdeuda = @pg_query($conexion,$resultado);
$pdf->SetFont('Arial','B',8);
$pdf->AddPage();
while($select2 = @pg_fetch_array($lisdeuda)):
$monto = $select2['monto'];
$tdeuda +=$monto;
$contador++;
$pdf->SetFont('Arial','I',8);
$pdf->Cell(22,4,$select2['descripcion'],0,0,'L',(($contador%2)==0));
$pdf->Cell(60,4,number_format($select2['monto'],2,'.',','),0,1,'R',(($contador%2)==0));
$pdf->SetFont('Arial','I',8);
endwhile;
$pdf->Line($pdf->GetX(), $pdf->GetY(), 200, $pdf->GetY());
$pdf->SetFont('Arial','B',8);
$pdf->Cell(40,4,"Total--->",0,0,'R');
$pdf->Cell(43,4,number_format($tdeuda,2,'.',','),0,1,'R');
$tdeuda=0;
$pdf->Output();
$pdf->Close();
?>
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder