How to retrieve date from mysql database in php?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • impin
    New Member
    • Jul 2010
    • 127

    How to retrieve date from mysql database in php?

    i have table cresults.

    Code:
    email	marks	last_submit
    pooja23@gmail.com	9	2013-05-24
    rajletsgetlost@gmail.com	5	2013-05-24
    romancingtherain@gmail.com	5	2013-05-24
    vidhya.vs@gmail.com	8	2013-05-24
    Code:
    $sql1="SELECT * FROM cresults where email='$login_session'";
    $result1=mysql_query($sql1);
    $last_submit=mysql_result($result1,"last_submit");	
    	echo " $last_submit";
    	if($last_submit==$today)
    	{
    		echo"you have already submitted";
    	}
    but this code
    Code:
    echo " $last_submit";
    not displaying the date. it displaying the email id. why? whats wrong in the code?!

    if i use like this
    Code:
    $sql1="SELECT last_submit FROM cresults where email='$login_session'";
    it works fine...
    why?!
Working...