Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

samples on retrieving specific date from database

Status
Not open for further replies.

psyren

Technical User
Jul 21, 2003
22
SG
hi.! well i'm not quite sure and exactly how to do this statement on how u want to retrieve a specific date from the database

i want to select a specific date from a single table from a drop down selection box of 4 tables

here's a page includes of a drop down selection box , where comprises of 4 database tables

<select name=&quot;select2&quot; size=&quot;1&quot;>
<option value=&quot;1&quot; selected>News and Updates</option>
<option value=&quot;2&quot;>Resource Center</option>
<option value=&quot;3&quot;>Favourites</option>
<option value=&quot;4&quot;>Meeting Minutes</option>
</select>

____________________________________

<select name=&quot;select&quot; size=&quot;1&quot;>
<option value=&quot;5&quot; selected>December 2003</option>
<option value=&quot;6&quot;>November 2003</option>
<option value=&quot;7&quot;>October 2003</option>
<option value=&quot;8&quot;>September 2003</option>
<option value=&quot;9&quot;>August 2003</option>
<option value=&quot;10&quot;>July 2003</option>
<option value=&quot;11&quot;>Jun 2003</option>
<option value=&quot;12&quot;>May 2003</option>
<option value=&quot;13&quot;>April 2003</option>
<option value=&quot;14&quot;>March 2003</option>
<option value=&quot;15&quot;>February 2003</option>
<option value=&quot;16&quot;>January 2003</option>
</select>








and another page displaying the database...

<%
Dim DaTe

Set dbGlobalWeb = Server.CreateObject(&quot;ADODB.Connection&quot;)
dbGlobalWeb.Open(&quot;searchdate&quot;)

DaTe = &quot;SELECT * FROM posts OR ListFiles OR favourites OR minutes &quot;

If Request.Form(&quot;select2&quot;) = &quot;5&quot; Then
DaTe = DaTe & &quot; WHERE datePosted LIKE '%&quot; & Request.Form(&quot;Title search&quot;) & &quot;%'&quot;
End If

Set rsGlobalWeb = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsGlobalWeb.Open SqlJunk, dbGlobalWeb, 3
%>
<%
If rsGlobalWeb.BOF and rsGlobalWeb.EOF Then%>

<h2 align=&quot;center&quot;>We did not find a match!</h2>
<%Else%>


<%If Not rsGlobalWeb.BOF Then%>

<h2>Here are the results of your search:</h2>

<%
Do While Not rsGlobalWeb.EOF
%>
<tr>
<td><%=rsGlobalWeb(&quot;5&quot;)%>

<% rsGlobalWeb.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rsGlobalWeb.Close
dbGlobalWeb.Close
%>

is there any error i've done? i dunno how to make a select statement where i choose one of the table and select the specific month to be exact... to view the dates included in that month...[sad]
1 drop down box for choosing which table i wanted to get the database and 1 drop down for choosing which month to be exact i want to view the information of the database..



hope u point out my mistakes ..thanks....






 
First off your database is not set up correctly. You need to store the ALL of the data in one table. You can categorize it with a CategoryID column. Another way would be to have four SELECT statements (one for each table) but that would be bad database design.

Second, the SQL syntax of SELECT * from tbl_1 or tbl_2 or tbl_3 is not correct.

Take care of the database first because that's your foundation. Then, ask your question again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top