Get ready for BLACK FRIDAY shopping starting in

Forums

This topic is locked

Help With Insert Statement

Posted 06 Jun 2006 04:27:11
1
has voted
06 Jun 2006 04:27:11 Malcolm X posted:

Hey there, I have the following insert statement which enters the search results of people searching a database. The problem I have with it is that it creates an entry for each search. This causes long lists that are hard to sort through. This list can be as long as 500 lines long.

Example:

Spotted Gum, Furniture Timber, Vicotira
Spotted Gum, Furniture Timber, Vicotira
Spotted Gum, Furniture Timber, Victoria
Spotted Gum, Framing Timber, Victoria
Merbau, Framing Timber, Queensland.

Is it possible to change or add something to the insert statement so that if it finds a duplicate search result, it just inserts a (1), so that it increases the value.

End result would look like this.

Spotted Gum, Furniture Timber, Vicotira 3
Spotted Gum, Framing Timber, Victoria 1
Merbau, Framing Timber, Queensland 1

I have inserted an extra row in the database called "searched".

Meaning, "searched" 3 times.

If I have to I am willing to get rid of the username insert.

So the code below would need something added to it saying, insert ("Keyword", ("CategoryTable", ("Location". If you find these results, just add a 1 in the "searched" column.

<%
Keyword = request.form("Keyword"
CategoryTable = request.form("CategoryTable"
Location = request.form("Location"
User = Session("MM_UserName"
%>
<%
set conn = Server.CreateObject("ADODB.Connection"
conn.Open MM_connSeek_STRING
SQL = "INSERT INTO tblSearchResults ([result], [category], [location], [user]) " _
& " VALUES('" & Keyword & "', '" & CategoryTable & "', '" & Location & "', '" & User & "')"
conn.Execute SQL
%>

Please ask if you need more info.

Mally

Reply to this topic