02.02.2013 Views

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

Flash MX 2004 Games : Art to ActionScript

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 14: Quizzes<br />

36 "\’, difficulty=" + difficulty + ", A=\’" + A +<br />

37 "\’, B=\’" + B + "\’, C=\’" + C + "\’, D=\’" + D +<br />

38 "\’ WHERE question=\’" + question + "\’";<br />

39 Response.Write("questionUpdated=true&");<br />

40 }else{<br />

41 //No entry so add it<br />

42 sqlStr = "INSERT INTO quiz " +<br />

43 "(category, difficulty, question, A, B, C, D, createdate) " +<br />

44 "VALUES (\’" + category + "\’, " + difficulty + ", \’" +<br />

45 question + "\’, \’" + A + "\’, \’" + B + "\’, \’" + C +<br />

46 "\’, \’" + D + "\’, \’" + dateStr + "\’)";<br />

47 Response.Write("questionAdded=true&");<br />

48 }<br />

49<br />

50 conn.Execute(sqlStr);<br />

51 conn.Close();<br />

52<br />

53<br />

54 %><br />

Listing 14.2<br />

Deleting a row<br />

Sometimes we will need <strong>to</strong> delete a row. Here the method is similar <strong>to</strong> the above. First we<br />

parse the querystring <strong>to</strong> find the current question. Then we make a connection by including<br />

the ‘dbconnect.asp’ file. Then we build a query this time using ‘DELETE FROM’ and the table<br />

name ‘WHERE question=’ the current value of the variable question. We can execute this<br />

directly on the database without the need for any recordsets. The code for this is in the file<br />

‘Examples\Chapter14\scriptsJS\deleteQuestion.asp’.<br />

1 <br />

2<br />

3 <br />

13 <br />

14

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!