0

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>
4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Zagga
0

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?

0

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...

0

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

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.