navigation
a webmaster learning community
     Home    Register     Search      Help      Login    
Sponsors

Shopping Cart Software
Ecommerce software integrated into Frontpage, Dreamweaver and Golive templates. No monthly fees and available in ASP and PHP versions.

Website Templates
We also have a wide selection of Dreamweaver, Expression Web and Frontpage templates as well as webmaster tools and CSS layouts.

Frontpage website templates
Creative Website Templates for FrontPage, Dreamweaver, Flash, SwishMax

Search Forums
 

Advanced search
Recent Posts

 Todays Posts
 Most Active posts
 Posts since last visit
 My Recent Posts
 Mark posts read

Microsoft MVP

 

searching a mysql query with a form

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
Printable Version 

All Forums >> Web Development >> ASP and Database >> searching a mysql query with a form
Page: [1]
 
crosscreek

 

Posts: 107
Joined: 2/5/2008
Status: offline

 
searching a mysql query with a form - 3/2/2008 1:36:10   
I am trying to create a page where someone can search the database for similar name matches.

For instance if you type in cross in the search form it will bring up

Cross Creek
Cross Creek's gal
and so on.

But if there's not matches then it would bring up no records.

I have the connection to the database, I just can't get it to pull the information. I know the query is correct, because I tested it.

Search form page

<form method=POST action="check.asp">
Search <input type=text name="doggy" size="33">
<p> <br>
<input type=submit value="Search">
</p>
</form>

check.asp page

<%@ Language=VBScript %>

<!-- #include virtual="/adovbs.inc" -->
<!-- #include file="openconn.inc" -->

<%

'read in the characters the user entered
Dim strDoggy
strDoggy = Trim(Request("doggy"))

Dim strSQL
strSQL = "SELECT Name FROM tblDog WHERE Name LIKE '%strDoggy%'"

Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset")
objRS.Open strSQL, myConn

If objRS.EOF then
Response.Write "no records"

Else
Response.Write "THERE'S A MATCH"
Do While Not objRS.EOF
objRS.MoveNext
Loop
End if

objRS.Close
Set objRS = Nothing

myConn.close
Set myConn = nothing
%>


Now I can get it to show NO Records, but not the dog Or in this case There's a match...I'll custom the page later.
I'm stumped. :)


crosscreek

 

Posts: 107
Joined: 2/5/2008
Status: offline

 
RE: searching a mysql query with a form - 3/2/2008 11:52:25   
figured it out:)

Dim strDoggy
strDoggy = Trim(Request("doggy"))

Dim strSQL
strSQL = "SELECT name FROM tbldog WHERE name LIKE '%" & _
strDoggy & "%'"

CODE IS PICKY!!!

It does feel pretty go to figure it out....


(in reply to crosscreek)
Page:   [1]

All Forums >> Web Development >> ASP and Database >> searching a mysql query with a form
Page: [1]
Jump to: 1





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts