|
| |
|
|
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.
|
|
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
|
|
|