0

Hello people i have a script that will show the days between two dates.Now my problem is The dates are stored in MS Access as text and when I compute it here in my script it always give the wrong value I really appreciate any help i can get also can you make it simple I'm quite new to php

<html>
<head>
<xml>[if gte mso 9]>
 <o:DocumentProperties>
  <o:LastAuthor>JLai0307910</o:LastAuthor>
  <o:Created>2010-12-10T00:41:57Z</o:Created>
  <o:LastSaved>2010-12-10T00:41:57Z</o:LastSaved>
  <o:Version>11.9999</o:Version>
 </o:DocumentProperties>
[endif]</xml>
<style>
table
	{mso-displayed-decimal-separator:"\.";
	mso-displayed-thousand-separator:"\,";}
@page
	{margin:1.0in .75in 1.0in .75in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;}
tr
	{mso-height-source:auto;}
col
	{mso-width-source:auto;}
br
	{mso-data-placement:same-cell;}
.style0
	{mso-number-format:General;
	text-align:general;
	vertical-align:bottom;
	white-space:nowrap;
	mso-rotate:0;
	mso-background-source:auto;
	mso-pattern:auto;
	color:black;
	font-size:10.0pt;
	font-weight:400;
	font-style:normal;
	text-decoration:none;
	font-family:Arial;
	mso-generic-font-family:auto;
	mso-font-charset:0;
	border:none;
	mso-protection:locked visible;
	mso-style-name:Normal;
	mso-style-id:0;}
td
	{mso-style-parent:style0;
	padding-top:1px;
	padding-right:1px;
	padding-left:1px;
	mso-ignore:padding;
	color:black;
	font-size:9.0pt;
	font-weight:400;
	font-style:normal;
	text-decoration:none;
	font-family:Arial;
	mso-generic-font-family:auto;
	mso-font-charset:0;
	mso-number-format:General;
	text-align:general;
	vertical-align:bottom;
	border:1px;
	mso-background-source:auto;
	mso-pattern:auto;
	mso-protection:locked visible;
	white-space:nowrap;
	mso-rotate:0;}
.xl24
	{mso-style-parent:style0;
	text-align:center;
	border:.5pt solid black;
	background:silver;
	mso-pattern:black none;}
.xl25
	{mso-style-parent:style0;
	text-align:right;
	border:.5pt solid silver;
	mso-background-source:auto;
	mso-pattern:auto;
	white-space:normal;}
.xl26
	{mso-style-parent:style0;
	border:.5pt solid silver;
	mso-background-source:auto;
	mso-pattern:auto;
	white-space:normal;}

</style>
<xml>[if gte mso 9]
 <x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>tblGroups</x:Name>
    <x:WorksheetOptions>
     <x:PageBreakZoom>126</x:PageBreakZoom>
     <x:Selected/>
     <x:Panes>
      <x:Pane>
       <x:Number>3</x:Number>
       <x:ActiveRow>10</x:ActiveRow>
       <x:ActiveCol>4</x:ActiveCol>
      </x:Pane>
     </x:Panes>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
  <x:WindowHeight>7005</x:WindowHeight>
  <x:WindowWidth>13275</x:WindowWidth>
  <x:WindowTopX>120</x:WindowTopX>
  <x:WindowTopY>60</x:WindowTopY>
  <x:TabRatio>150</x:TabRatio>
  <x:ProtectStructure>False</x:ProtectStructure>
  <x:ProtectWindows>False</x:ProtectWindows>
 </x:ExcelWorkbook>
[endif]</xml>


<title></title></head>
<body bgcolor="66FF66"> 

<center>
<table border='1'>
	<center>
	<tr><td><img src="http:\\10.81.65.86\library\SGA\sga.jpg" /></td>
	
	<td><font face='Arial' size='12'><h3>  &nbsp;<p>Small Group Activities Improvement Proposal</p> <center>System Online</center>&nbsp; <td><img src="http:\\10.81.65.86\library\SGA\sga.jpg" /></td>	</center></h3></font></td>
	</tr>
	</center>
	</table>
<center> <font face='Arial'> <h3><a href='http://10.81.65.86/library/SGA/sandbox/admin/menuadmin.php'>HOME</a>&nbsp;||&nbsp;<a href='http://10.81.65.86/library/SGA/sandbox/admin/viewipsadmin.php'>View/Edit IPS</a>&nbsp;||&nbsp;<a href='http://10.81.65.86/library/SGA/sandbox/admin/ipsentryadmin.php'>Submit IPS</a>&nbsp;||&nbsp;<td><a href='http://10.81.65.86/library/SGA/sandbox/admin/reports.php'>Reports</a></td></center></h3></font>
	
<font face='Arial'>
<?php
session_start();
echo $_SESSION['name'];
?>


</font>	
	
	<hr>
	
<br>
<br>

<?php
		//Search returned values are by manager
	  $post=$_POST['test1'];
	  $trimmed=trim($post);
	 $rownum=0;
	 $conn=odbc_connect('PEDB','',''); 
	  
	  if (!$conn) 
		{exit("Connection Failed: " . $conn);}
		
		$sql="SELECT *  FROM tblIps where Manager like '%$trimmed%' ";
		
		$rs=odbc_exec($conn,$sql);
		
		if($post=="")
		{
			header("location:http://10.81.65.86/library/sga/sandbox/admin/viewipsadmin.php");
		}
		if (!$rs) 
		{exit("Error in SQL");} 
		echo "<font face='Arial' size='3'>";
		echo "<table  border='0'bgcolor=#ffffff>";
		echo "<th>Manager &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>"; 
		echo "<th>Department&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>"; 
		//echo "<th>material number&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>"; 
		echo "<th>Group Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>"; 
		//echo "<th>Area&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		//echo "<th>Process&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		//echo "<th>Groupleader&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th>Ips Number(Click to View)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th>Ips Number(Click to Edit)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th>Project Title&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th>Facilitator&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th>Date Submitted&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th>Status of Proposal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		
		echo "<th style='display:none' >Date Reviewed by Manager&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th style='display:none'>Date Reviewed by Engineer&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th style='display:none'>Date Reviewed by Validator&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		
		echo "<th>Review Aging Days&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th>Evaluation Aging Days&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		echo "<th>Closed Aging Days&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</th>";
		
		echo "</tr>";
		echo "</font>";
		
		while ($array=odbc_fetch_row($rs)) 
		{
		
		$manager=odbc_result($rs,"Manager");
		$department=odbc_result($rs,"Department");
		$groupname=odbc_result($rs,"Group_Name");
		$ipsnumber=odbc_result($rs,"Ips_number");
		$projecttitle=odbc_result($rs,"Project_Title");
		$facilitator=odbc_result($rs,"Facilitator");
		$datesubmitted=odbc_result($rs,"Date_submitted");
		$statusofproposal=odbc_result($rs,"Status_of_proposal");
		
		$date1=odbc_result($rs,"Date_submitted");
		$date2=odbc_result($rs,"Date_sgaapproved");
		$date3= date("Y-m-d");
	   
		$date4=odbc_result($rs,"Date_managerapproved");
		$date5=odbc_result($rs,"Date_validatorapproved");
		$date6=odbc_result($rs,"Date_engineerapproved");
		$date7=odbc_result($rs,"Date_facilitatorapproved");
		$date8=odbc_result($rs,"Date_sgastandardized");
		$date9=odbc_result($rs,"Date_managerstandardized");
		$projecttitletrim=substr($projecttitle,0,50);
		
		//$truncateprojecttitle=myTruncate($projecttitle,30);
		
		
		
		//$date1 = "2007-03-24"; $date2 = "2007-03-26"; 
		
		//for review
		$date_a = strtotime($date2);
		$date_b = strtotime($date4); 
		
		
		$days1 = abs($date_b - $date_a) / (60*60*24); 
	
	
		
		
		
	
	
		echo 
		"<tr align=center>
		
		<td>$manager</td>
		<td>$department</td>
		<td>$groupname</td>
		<td><a href='http://10.81.65.86/library/SGA/sandbox/admin/searchipsprocessadmin.php?ipsnumber=$ipsnumber'  >$ipsnumber</a></td>
		<td><a href='http://10.81.65.86/library/SGA/sandbox/admin/searchipsprocess2admin.php?ipsnumber=$ipsnumber'  >$ipsnumber</a></td>
		<td>$projecttitletrim ...</td>
		<td>$facilitator</td>
		<td>$datesubmitted</td>
		<td>$statusofproposal</td>
		<td style='display:none'>$date2</td>
		<td style='display:none'>$date3</td>
		<td style='display:none'>$date4</td>
		<td style='display:none'>$date6</td>
		<td style='display:none'>$date5</td>
		<td style='display:none'>$date7</td>
		<td style='display:none'>$date8</td>
		<td style='display:none'>$date9</td>
	";
	//this will print the difference between days
	echo "<td>"; echo number_format($days1),"days"; echo "</td>";
	
		
		
	
	
		echo "</tr> ";
		
		
	$rownum++;
			
		}
		
	
	// printf (" %d months, %d days\n", $months, $days);
	//<td>$months2 months, $days2 days</td>
	//	<td>$months3 months, $days3 days</td>
		echo "</table>";
		echo "<center>Your search returned $rownum Result</center>";
		
		echo "$date3";
?>














<center> <font face='Arial'> <h3><a href='http://10.81.65.86/library/SGA/sandbox/admin/menuadmin.php'>HOME</a>&nbsp;||&nbsp;<a href='http://10.81.65.86/library/SGA/sandbox/admin/viewipsadmin.php'>View/Edit IPS</a>&nbsp;||&nbsp;<a href='http://10.81.65.86/library/SGA/sandbox/admin/ipsentryadmin.php'>Submit IPS</a>&nbsp;||&nbsp;<td><a href='http://10.81.65.86/library/SGA/sandbox/admin/reports.php'>Reports</a></td></center></h3></font>
<hr>
<br>
			<center><font size='-50'><font face='Arial'>Hitachi Global Storage Technologies Philippines Corporation</font ></center>
			<center><font size='-50'><font face='Arial'>Process Excellence Department Small Group Activities</h1></center></font>
</body>
</html>
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by priyadarshi206
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.