 |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Dreamweaver (all versions) section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 5th, 2006, 06:52 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
That's consistent with the previous SQL statement you posted.
The variables Keyword, CategoryTable and Location don't have a value. Where do you assign these variables a value?
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|

June 5th, 2006, 07:16 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I see now, added Part 1 just above the code and its inserting 3 out of 4. The 'user' is left blank in the database.
Part 1
<%
Keyword = request.form("Keyword")
CategoryTable = request.form("CategoryTable")
Location = request.form("Location")
User = Session("MM_UserName")
%>
Part 2
<%
set conn = Server.CreateObject("ADODB.Connection")
conn.Open MM_connSeek_STRING
SQL = "INSERT INTO tblSearchResults ([result], [category], [location], [user]) " _
& " VALUES('" & Keyword & "', '" & CategoryTable & "', '" & Location & "', '" & MM_UserName & "')"
conn.Execute SQL
%>
|
|

June 5th, 2006, 07:24 AM
|
|
Authorized User
|
|
Join Date: Aug 2005
Posts: 96
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Heya, changed the value from this...
& " VALUES('" & Keyword & "', '" & CategoryTable & "', '" & Location & "', '" & MM_UserName & "')"
To this...
& " VALUES('" & Keyword & "', '" & CategoryTable & "', '" & Location & "', '" & User & "')"
And it worked fine.
Again.
Thanks Imar.
|
|

June 5th, 2006, 07:29 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Do you have Option Explicit on top of your ASP page?
If not, it's recommended to do so. Using Option Explicit forces you to Dim all your variables. With that option turned on, the script parser would have seen that MM_UserName was an undeclared variable, and would have thrown an error.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Author of ASP.NET 2.0 Instant Results and Beginning Dreamweaver MX / MX 2004
|
|
 |