Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Problems with SELECT where curdate()

Author  Topic 

QuintonWatts
Starting Member

1 Post

Posted - 2006-11-11 : 12:06:15
Have got the following:

$result = mysql_query("SELECT * FROM becevent WHERE eventdate>=curdate() ORDER BY eventdate");

//==============Line 80
while($row = mysql_fetch_array($result))
{
echo "

<TABLE WIDTH='100%' BORDER='0' CELLSPACING='0' CELLPADDING='2' >
<TR CLASS='tabletop'>
<TD WIDTH='4%'>NEW</TD>
<TD WIDTH='10%'>Date</TD>
<TD WIDTH='60%'>Event</TD>
<TD WIDTH='19%'>Location</TD>
<TD WIDTH='7%'>Details</TD>
</TR>";

while($row = mysql_fetch_array($result))
{
echo "
<tr>
<td CLASS='new'></td>
<td CLASS='table'>" . $row['eventdate'] . "</td>
<td CLASS='table'>" . $row['title'] . "</td>
<td CLASS='table'>" . $row['town'] . ", " . $row['county'] . "</td>
<td CLASS='table'><A HREF='EventDetails.php?id=" . $row['id'] . "'>Details</A></td>
</tr>";
}
echo "
</table>";
}

However it will not return the records with dates from the day I am in (ie it is 2006-11-11 today and only events from 2006-11-12 are being returned.

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-11-11 : 12:28:18
your curdate() probably returns the current date with time part also.
but since i'm not familiar with mySql date functions i can't comment on how to fix this.
in sql server there is a dateadd function...



Go with the flow & have fun! Else fight the flow
blog thingie: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-12 : 20:00:44
Post at www.DBForums.com or www.MYSQL.com

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -