cooper549 Posted May 1, 2013 Posted May 1, 2013 (edited) Im having some trouble with a MySQL database that I've been using with an online application form i developed a few weeks back. I thought I had finished the form as i didn't have any errors until we have come to test it over the past few days. The problem is When 2 different users use the form, or the same user closes the browser and starts a new session, the newest data will overwrite all other data in each field across all tables. Also if one person is filling out the form and a second users then starts a few moments after, the first person is then referred to the beginning when they move forward a page as the data base has lost all previous information. you can see the form at www.moorpark.lancs.sch.uk/teachapp/ the pages go as follows with each step page running an included 'process' page default.asp step-2.asp -process-1.asp step-3.asp -process-2.asp step-4.asp -process-3.asp step-final.asp -process-4.asp if needed i can sort out some paste bins of the full page code. Thanks! I have just noticed i have missed a 'where' statment off the end of my sql syntax. Edited May 1, 2013 by cooper549 Think i might have solved it :)
Marci Posted May 1, 2013 Posted May 1, 2013 (edited) Pastes of the SQL statements that update / insert into the database would be essential here. Essentially sounds like you're using an UPDATE when you should be using an INSERT INTO basically... and some of your javascript functionality (eg: onfocus within the "title" input) is incorrect. Edited May 1, 2013 by Marci
cooper549 Posted May 1, 2013 Author Posted May 1, 2013 Hes a snippet from the process-1.asp. It inserts fine when nothing else was present the problem came to when it was updating, of which i think i have fixed now. SQLch = "SELECT UsersRef FROM teachapp WHERE UsersRef = '" & UsersRef & "'" Set RSch = Conn.execute(SQLch) if RSch.EOF then SQLa = "INSERT into teachapp (appsDate, Us......(CUT OUT CODE TO SAVE SPACE).....','"& sONEotherpostcode &"','"& sONEothertel &"');" Conn.execute (SQLa) SQLa = "INSERT into teachapp2 (UsersRef) VALUES ('"&UsersRef&"');" Conn.execute (SQLa) SQLa = "INSERT into teachapp3 (UsersRef) VALUES ('"&UsersRef&"');" Conn.execute (SQLa) SQLa = "INSERT into teachapp4 (UsersRef) VALUES ('"&UsersRef&"');" Conn.execute (SQLa) SQLa = "INSERT into teachapp5 (UsersRef) VALUES ('"&UsersRef&"');" Conn.execute (SQLa) else SQLu = "update teachapp set appsDate='"&appsDate&"',UsersRef='"&Us............(CUT OUT CODE TO SAVE SPACE)..................stcode&"',sONEothertel='"&sONEothertel&"'" Conn.execute (SQLu) SQLu = "update teachapp2 set UsersRef='"&UsersRef&"'" Conn.execute (SQLu) SQLu = "update teachapp3 set UsersRef='"&UsersRef&"'" Conn.execute (SQLu) SQLu = "update teachapp4 set UsersRef='"&UsersRef&"'" Conn.execute (SQLu) SQLu = "update teachapp5 set UsersRef='"&UsersRef&"'" Conn.execute (SQLu) end if end if That was my original however ive noticed that at the end of my updates i missed where UsersRef='"&UsersRef&"'"
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now