All pastes #471205 Raw Edit

Mine

public text v1 · immutable
·published 2007-05-04 19:55 UTC
rendered paste body
<?php

if (($_POST['txtday1'] && $_POST['txtmonth1'] && $_POST['txtyear1'] !="") )
{
	$txtday1=$_POST['txtday1'];
	$txtmonth1=$_POST['txtmonth1'];
	$txtyear1=$_POST['txtyear1'];
	$txtday2=$_POST['txtday2'];
	$txtmonth2=$_POST['txtmonth2'];
	$txtyear2=$_POST['txtyear2'];
 
 $date1 = mktime ( $txtmonth1, $txtday1, $txtyear1 );
 $date2 = mktime ( $txtmonth2, $txtday2, $txtyear2 );
 
/* 		$date1 = $txtyear1+"-"+$txtmonth1+"-"+$txtday1;
		$date2 = $txtyear2+"-"+$txtmonth2+"-"+$txtday2;  */
		// $thedate1 = date("Y-m-d",$date1);
// $thedate2 = date("Y-m-d",$date2);		 
	
	
	// $thedate1 = $txtyear1 .'-'. $txtmonth1 .'-'.  $txtday1; 
	/* $datevalue = date("Y-m-d",$thedate); */

	
	
	include "pgsql.class.php";
	$pgsqldb = new pgsql("localhost","task","tele","tiny");
	$pgsqldb->connect();
	$pgsqldb->query('SELECT result_time as "Result Time",voltage as "Voltage" FROM sample_mts310 WHERE nodeid=2 AND result_time > '.$date1.' and result_time < '.$date2.' ORDER BY result_time DESC LIMIT 25;');

echo $pgsqldb->getResultAsTable();

}

elseif (($_POST['submit']  != "") )
{
	$operator = $_POST['operator'];
	$txtvoltage = $_POST['txtvoltage'];
	
	
	include "pgsql.class.php";
	$pgsqldb = new pgsql("localhost","task","tele","tiny");
	$pgsqldb->connect();
	$pgsqldb->query('SELECT result_time as "Result Time",voltage as "Voltage" FROM sample_mts310 WHERE nodeid=2 AND voltage '.$operator.' '.$txtvoltage.' ORDER BY result_time DESC LIMIT 25;');
	echo $pgsqldb->getResultAsTable();
}



else {
	echo " ERROR : EMTPY FIELD MAYBE !";
}
?>