Jump to content

Regarding Date?


divadiva

Recommended Posts

Experts

 

Can you please help me with this problem?

 

I can display date using 'curdate'.But ,what I want to do is that I want to save todays date .So,that next time I run my program the old dates doesnt change but new dates keep on updating.

 

Heres is my display page:'Initialcapturedate' and 'curdate' are the date functions I am using.

 

<?php
include("mainpage.php");
include("database.php");

if(isset($_GET['idsite']))
{
$idsite = 0;
$idsite = $_GET['idsite'];

if($idsite == 'All')
{
	$res = executeAllRecords("select *, date(initialdatecapture) as initialdatecapture, date(date) as curdate from data order by iddata");	
	echo '<h3 style="color:#64E986"> Data from all sites</h3>';
}
else
{
	$res = executeAllRecords("select *, date(initialdatecapture) as initialdatecapture, date(date) as curdate from data where site='".$idsite."' order by iddata");	
	echo '<h3 style="color:#64E986"> Data from site: ' . $idsite.'</h3>';
}


echo '<br clear = "both"/>';
echo '<br clear = "both"/>';
echo '<br clear = "both"/>';
}
else
{
echo "Select a website to be displayed ";
echo "<ul>
		<li><a href=\"showdata.php?idsite=All\">All sites</a></li>
		</ul>";
return;
}

if(mysql_num_rows($res) == 0)
return;

echo '<table cellspacing="1" border="1">
	<tr>
		<th>SerialNumber</th>
		<th>ProductionYear</th>
		[b]<th>Initial Data captured</th>
		<th>Date sold</th>	[/b]

	</tr>
	';

while($row = mysql_fetch_array($res))
{
$printRow = '';
$count = 0;

$printRow .= printColumn($row['Serial']);
$printRow .= printColumn($row['ProductionYear']);
[b]$printRow .= printColumn($row['initialdatecapture']);
if(strlen($row['curdate']) == 0)
	$row['curdate'] = '';[/b]
$printRow .= printColumn($row['curdate']);
echo '<tr>'.$printRow.'</tr>
	';
}

echo '</table>';

function printColumn($colValue)
{
return '<td>'.$colValue.'</td>';
}

include("footer.php");
?>

 

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/123430-regarding-date/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.