hi all,
i need to display only date in the createddate column and updateddate column. but iam getting 0000-00-00 00:00:002010-03-26 in the browser and in backend like 0000-00-00 00:00:00 so i need a help.

<?php
ob_start();
@session_start();
require_once ("check.php");
createsessions($username,$password);
	$con=mysql_connect("10.70.1.50","invensis","invensis");
	if(!$con)
		{
			die('Could not connect: ' . mysql_error());
		}
	mysql_select_db("database_myproject",$con);
	$query= mysql_query("SELECT * FROM projects where createdby='$_SESSION[username]'");
	mysql_error();
	$num=mysql_num_rows($query);
	mysql_close($con);
?>
<html>
<body>
<table width="100%">
<tr><td> <img src="Logofinalcopy.gif">
</td></tr>
	<tr>
		<td bgcolor="aqua"><h2>Project Management</h2></td>
	</tr></table>
	<div><table>
	<tr>			
		<td  align="right" style="width: 1000px">&nbsp;</td>
		<td  align="left" style="width: 177px"><a href="Projectmgmt.php" onclick="window.open('http://localhost/Project/projectcreation.php','popup','width=330,height=250,scrollbars=no,resizable=no,toolbar=no,directories=no,location=center,menubar=no,status=no,left=500,center=0,top=350')">Add Project</a></td>
	</tr>
</table></div>
<table border="1" cellspacing="0" cellpadding="0" align="center" style="width: 500px">
	<tr>
		<th>projectid</th>      
		<th>projectname</th>
		<th>allocatedmemory</th>
        <th>createddate</th>
        <th>updateddate</th>
        <th>createdby</th>
	</tr>
<?php
$i=0;
while ($i < $num){
$f1=mysql_result($query,$i,"projectid");
$f2=mysql_result($query,$i,"projectname");
$f3=mysql_result($query,$i,"allocatedmemory");
$f4=mysql_result($query,$i,"createddate");
$f5=mysql_result($query,$i,"updateddate");
$f6=mysql_result($query,$i,"createdby");
?>
<tr>
   	<td><?php echo $f1;?></td>
	<td><?php echo $f2; ?></td>
	<td><?php echo $f3; ?></td>
    <td><?php echo $f4;$tomorrow = mktime(date("m"),date("d"),date("Y"));
                       echo date("Y-m-d", $tomorrow);?></td>
    <td><?php echo $f5;$tomorrow = mktime(date("m"),date("d"),date("Y"));
                       echo date("Y-m-d", $tomorrow);?></td>
    <td><?php echo $f6;?></td>          
   	<td><a href =http://localhost/Project/Projectmgmt.php onclick="window.open('http://localhost/Project/updateproject.php?f1=<?php echo $f1;?>','popup','width=350,height=200,scrollbars=no,resizable=no,toolbar=no,directories=no,location=center,menubar=no,status=no,left=500,center=0,top=350')">
	edit</a></td>
</tr>
<?php
$i++;
}
?>
</table>
</body>
</html>

I don't see how the code relates to your question. Could you mention a line which expresses your question as I can't find what would yield 00:00:002010-03-26?

Hey niths,

Do not post your entire code like this. Mention the area where yo found difficulty or the problem.Nobody will look through your entire code and find you the solution.So make everything simple. This is just my opinion okey...

Member Avatar for Zagga

iam getting 0000-00-00 00:00:002010-03-26 in the browser and in backend like 0000-00-00 00:00:00

From this, it looks to me like your database is expecting a date AND time input, but you are only supplying the date. Have a look at your database table and see what format your dates are stored in.

Zagga

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.