File: tsld011.htm

package info (click to toggle)
aolserver4 4.5.1-15.1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 11,772 kB
  • sloc: ansic: 45,120; tcl: 5,532; sh: 1,021; makefile: 380; pascal: 219; php: 13
file content (58 lines) | stat: -rw-r--r-- 1,280 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58

<HTML>

<HEAD>

<meta name="GENERATOR" content="Microsoft Internet Assistant for PowerPoint 97">
 <TITLE>Example: Database Access</TITLE> 
</HEAD>

<BODY     >

 <H1>Example: Database Access</H1> 
 <P><UL>
ns_register_proc GET /demo/movies getMovies
</UL><UL>

</UL><UL>
proc getMovies {} {
</UL><UL>
  set page &#060html&#062&#060body&#062\nCurrent Movies:\n
</UL><UL>
  set db [ns_db gethandle moviedb]
</UL><UL>
  set row [ns_db select $db select * from movies]
</UL><UL>
  while {[ns_db getrow $db $row]} {
</UL><UL>
    append page [ns_set get $row movie]&#060br&#062\n
</UL><UL>
  }
</UL><UL>
  append page &#060/body&#062&#060/html&#062
</UL><UL>
  ns_set free $row
</UL><UL>
  ns_db releasehandle $db
</UL><UL>
  ns_return 200 text/html $page
</UL><UL>
}</UL></P>
<P><UL>
<LI><H2>ns_db can be used to access an SQL database:</H2>
</UL></P>
<P></P> 
<P>
<TABLE>
  <TD HEIGHT=100 WIDTH=100> <A HREF="tsld010.htm">Previous slide</A> </TD>
  <TD HEIGHT=100 WIDTH=100> <A HREF="tsld012.htm">Next slide</A> </TD>
  <TD HEIGHT=100 WIDTH=150> <A HREF="tsld001.htm">Back to first slide</A> </TD>
  <TD HEIGHT=100 WIDTH=150> <A HREF="sld011.htm">View graphic version</A> </TD>
</TABLE>
<BR>
</P>



</Body>
</HTML>