some corrections pinal
he wants to check events in between the two dates...
and why use select * in a query where u r checking count...
Select * should be avoided if possible...
<cfquery name="Qry_CheckEvent" datasource="dsn">
select count(title) from your table
where dt_start >= <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE" VALUE="#form.dt_start#"> and dt_end <= <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE" VALUE="#form.dt_end#">
</cfquery>
now this will check if theres any event that is scheduled between the start and end date..
but if u r checking for events that just start between these dates then change the query a little...
<cfquery name="Qry_CheckEvent" datasource="dsn">
select count(title) from your table
where dt_start >= <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE" VALUE="#form.dt_start#"> and dt_start <= <CFQUERYPARAM CFSQLTYPE="CF_SQL_DATE" VALUE="#form.dt_end#">
</cfquery>
Regards
Hart
Main Topics
Browse All Topics





by: pinaldavePosted on 2004-09-05 at 08:45:47ID: 11984595
<form action="action page" post="post">
<input type="text" name="" value="">
<input type="text" name="" value="">
<input type="text" name="" value="">
<input type="text" name="" value="">
<input type="submit" type="submit" value="submit">
</form>
now on your action page
<cfquery name="select_q" datasource="dsn">
select * from your table where dt_start <= #form.dt_start# and dt_end >= #form.dt_end#
</cfquery>
<cfif select_q.recordcount > 0 >
you can not insert your query
</cfelse>
<cfquery name-"insert_q" datasrouce="dsn">
your insert query
</cfquery>