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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search and organization

Status
Not open for further replies.

melocco

Technical User
Jan 19, 2001
229
US
I had some one make a ASP page for me ( but he didn't make it in alphabetical order, and also I was wanting a search engine to search the page. I can't get intouch with him now and I have been searching the net, but have yet to find a way to do it yet.. Is there a way to put a search on the page easy, and the main one is putting them in Alpha order... Is there something I can do to put them in order of some way? Thanks for any help.. Mel...
 
Looks like its in Alphabetic order to me.. lol well to do the search thing edit your SELECT statement...

your select statment would be something like

mySQL = "SELECT * FROM movies"

First start by making a form ...
Code:
<form name=&quot;form1&quot; method=&quot;post&quot; action=&quot;main.asp&quot;>
<input type=&quot;text&quot; name=&quot;searchbox&quot;><input type=&quot;submit&quot; name=&quot;Submit&quot; value=&quot;Submit&quot;>
</form>


Then above your sql statement on the main.asp page do something like this...

<%

Dim SearchWord

SearchWord = Request.Form(&quot;searchbox&quot;)

'# If Search keyword is empty or is less then 3 letters go back to the search page...

If SearchWord = &quot;&quot; or Len(SearchWord) < 3 then
Response.Redirect &quot;search.asp&quot;
End if

'# movies = table_name in db where movies are listed
'# movietitle = column_name in db of your movie title
'# Left(SearchWord) looks at the left 4 letters and returns the results (you dont want it to look at the whole word then if its spelt wrong or something it wont return good results..)


mySQL = &quot;SELECT * FROM movies WHERE (movietitle Like '&quot; & Left(SearchWord,4) & &quot;%')&quot;

Let me know if you have further questions regarding this.

Jason
 
oh and to alphatize go like so..

mySQL = &quot;SELECT * FROM movies WHERE (movietitle Like '&quot; & Left(SearchWord,4) & &quot;%') Order by movietitle&quot;
 
OK.. Thanks for your help.. As for the list in alpha order, they are up till the end.. When I add more to the list they are not in order.. It's a access list and I can make the list in alpha order, but it doesn't make the asp in order like that.. Again, I'm still new at this but I would love to learn...

I started off by trying the alpha order but didn't see the mySQL =&quot;Select * in the asp. also since the list is in access, is that going to work?? I have MySQL installed and my main site is running PHP with MySQL..
Anyway I thought it might help if I put the asp code up that he made.. That might help you see what he has and tell me what I need to put.. Thanks.....

<%@ Language=VBScript %>

<%
On Error Resume Next

Dim Cnn, Rs
Dim LinkToImdb

Set Cnn = Server.CreateObject(&quot;ADODB.Connection&quot;)
Set rs = Server.CreateObject(&quot;ADODB.Recordset&quot;)

With Cnn
.ConnectionString = &quot;DSN=ODBCMelocco&quot;
.ConnectionTimeout = 30
.CommandTimeout = 30
.Open
End With

Rs.Open &quot;Movies&quot;, Cnn, 2, 3

Rs.MoveFirst

Response.Write (&quot;<BR> <DIV align = center> <TABLE Cols = 2 Border = 1 Bordercolor = Black Cellspacing = 0 Cellpadding = 0>&quot;)

Do Until Rs.EOF


LinkToImdb = Rs.Fields(&quot;Information&quot;).Value
LinkToImdb = Replace(LinkToImdb, &quot;#&quot;, &quot;&quot;)

Response.Write(&quot;<TR> <TD>&quot;)
Response.Write Rs.Fields(&quot;Movies List&quot;).Value & &quot;</TD><TD>&quot;
Response.Write &quot;<A href = '&quot; & LinkToImdb & &quot;'>&quot; & LinkToImdb & &quot;</A>   </TR>&quot;

Response.Write(&quot;<TR> <TD>&quot;)
Response.Write Rs.Fields(&quot;Movies List&quot;).Value & &quot;</TD><TD>&quot;
Response.Write &quot;<A href = '&quot; & LinkToImdb & &quot;'>&quot; & LinkToImdb & &quot;</A>   </TR>&quot;

Rs.MoveNext

Loop

Response.Write (&quot;</TABLE></DIV>&quot;)

Rs.MoveLast

Rs.Move -4




%>

<HTML>
<HEAD>
</HEAD>
<BODY>
</BODY>
</HTML>

Thanks alot.. If there is anything I can help you with let me know.. Mel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top