Simple ASP MYSQL question

L

Lawrence

Hey

I have successfully been able to read from a MYSQL database using
this:

set rs = conn.Execute("SELECT Password FROM UserTable WHERE Username =
'" & entuser & "' AND Password = '" & entpass & "'")

Do while not rs.eof ' Do until it reaches end of db
actualpass = rs("Password")
rs.MoveNext ' Next record
loop


But I now want to be able to add new records to tables, I used this
code, but it does not seem to be able to work, any ideas?

set rs = conn.Execute("INSERT INTO UserTable SET Username = '" &
username & "' AND Password = '" & username & "' AND FirstName = '" &
username & "' AND LastName = '" & username & "' AND Email = '" &
username & "' AND confirm = 0 AND confstring = '" & passconf & "'")
 
E

Evertjan.

Lawrence wrote on 30 apr 2007 in microsoft.public.inetserver.asp.general:
set rs = conn.Execute("INSERT INTO UserTable SET Username = '" &
username & "' AND Password = '" & username & "' AND FirstName = '" &
username & "' AND LastName = '" & username & "' AND Email = '" &
username & "' AND confirm = 0 AND confstring = '" & passconf & "'")

I am not a mySql specialist, but the AND's seem faulty.

Try something like:

SQL="INSERT INTO UserTable (Password , FirstName , LastName )"&_
"VALUES ('" & pw & "','" & fn & "','" & ln & "')"
response.write SQL
response.end
' remark these 2 lines above when you are satisfied with the result
set rs = conn.Execute(SQL)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top