1a.Develop and demonstrate a XHTML document that illustrates the use external style sheet, ordered list, table, borders, padding, color, and the <span> tag.

bewgrosseteteΛογισμικό & κατασκευή λογ/κού

13 Δεκ 2013 (πριν από 3 χρόνια και 11 μήνες)

77 εμφανίσεις

1
a
.
Develop and demonstrate a XHTML document that illustrates the use
external

style sheet,

ordered list,

table,

borders,

padding,

color,
and the <span> tag.



<html xmlns="http://www.w4.org/1999/xhtml">

<head><title>PROGRAM1</title>

<link rel="stylesheet"

type ="text/css" href="pgmstyle.css" />

</head>

<body>

<
h3>Linux file system</h3>

<ol><li>root


<ol class ="orange">


<li>bin


<ol><li>cp</li>


<li>mkdir</li>

</ol></li>

<li>etc

<ol><li>password</li>

<li>login</li>

</ol></li>

</ol></li>

<li>home

<ol c
lass="red">

<li>06CSE

<ol><li>cse61</li>

<li>cse61</li>

</ol>

</li>

<li>07CSE

<ol><li>cse62</li>

<li>cse40</li>

</ol>

</li>

</ol>

</li></ol>

</body></html>


Pgmstyle.css:

.orange {font
-
size:18pt;color:orange;font
-
weight:bold}

.red
{font
-
size:20pt;color:red;font
-
weight;bold}



1b. Develop and
demonstrate a

X
HTML document that illustrates

the use
external style
sheet borders
, padding, color, and the <span> tag.

<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>PROGRAM1b</title>

<link rel="stylesheet" type="text/css" href="1b.css" />

</head>

<body>

<h2> fruit juice </h2>

<table border="5">

<tr><th></th>


<th>Apple</th>


<th>Orange</th>


<th>Grapes</th>

</tr>

<tr> <th>Breaffast</th>


<td>0</td>


<td>1</td>


<td>0<
/td>

</tr>

<tr> <th>Lunch</th>


<td>1</td>


<td>0</td>


<td>0</td>

</tr>

<tr>


<th>Dinner</th>


<td>0</td>


<td>0</td>


<td>1</td>

</tr>

</table><br/><br/><br/>

<p class ="major">

<span>padding</span>is the space between content of an
<span>element</
span>and i

ts <span>border</span><br/>

<span>major</span>is the space between <span>border of an
element</span>and its<

span> neighbour</span></p>

</body>

</html>

1b.css:

table {border
-
color:green;color:blue;border
-
style:dashed;border
-
width:thick;}

span
{font
-
size:20pt;color:red;font
-
weight:bold;}

caption {font
-
size:28pt;color:white;background
-
color:red;font
-
weight:bold;}

p.major {font
-
size:14pt;font
-
style:italic;font
-
family:"times new roman";}



2a. Develop and demonstrate a XHTML file that includes
Java
Script

script for the following
problems:

a) Input: A number n obtained using prompt



Output: The first n Fibonacci numbers

<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>fibonaci numbers</title></head>

<body>

<script
type="text/javascript" src="fb.js">

</script>

</body>

</html>


fb.js
:

var f1=0;

var f2=1;

var n=prompt("input n","");

alert(f1);

alert(f2);

for(i=2;i<=n;i++)

{

f3=f1+f2;

f1=f2;

f2=f3;

alert(f3);

}
2b. Develop and demonstrate a XHTML file that includes
JavaScript

script for the following
problems:

b) Input
: A number n obtained using prompt


Output: A table of numbers from 1 to n and their squares using alert

<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>TABLE OF SQUARES</title></head>

<b
ody>

<h1>SQUARE OF NUMBERS</h1>

<b>

<script type="text/javascript" src="sqr.js">

</script></b>

</body>

</html>


sqr.js:


var num=prompt("Enter the Number:
\
n","");

mgrstr="Number and its square is
\
n";

for(i=1;i<=num;i++)

{

mgrstr=mgrstr+i+"
-
"+i*i+"
\
n";

}

document.write("" +mgrstr);



3a.Develop and demonstrate

a XHTML file that includes
JavaScript

script that uses functions for the following problems:

a) Parameter: A string


Output: The position in the string of the left
-
most vowel


<html xmlns="www.
w3.org/1999/xhtml">

<head><title>pgm3a</title></head>

<body>

<h1>
PROGRAM ON JAVASCRIPT</h1>

<script type="text/javascript" src="3a.js">

</script>

</body>

</html>



3a.js:

var str=prompt("enter a string:","");

vowel(str);

function vowel(str)

{

var
p=str.search(/[aeiouAEIOU]/);

if(p>=0)

alert("vowel at leftmost position found in the location:"+(p+1));

else

alert("no vowel found");

}


3b.Develop and demonstrate
a XHTML

file that includes JavaScript script that uses

functions for t
he following problems:

b) Parameter: A number


Output: The number with its digits in the reverse order


<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>JAVASCRIPT</title></head>

<body>

<h1>PROGRAM ON REVERSE ORDER</h1>

<script type="
text/javascript" src="3b.js">

</script>

</body>

</html>


3b.js:

var n=prompt("enter the value of n to find its reverse:","");

reverse(n);

function reverse(n)

{

var m=n,r=0;

while(m>0)

{

r=r*10+m%10;

m=parseInt(m/10);

}

alert("the reverse of"+n+"is::"+r);

}




4a) Develop and demonstrate, using JavaScript script, a XHTML document that collects the
USN ( the valid format is: A digit from 1 to 4 followed by two upper
-
case characters followed
by two digits followed by two upper
-
case characters followed by three

digits; no embedded
spaces allowed) of the user. Event handler must be included for the form element that
collects this information to validate the input. Messages in the alert windows must
be produced when errors are detected.


<ht
ml xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>JAVASRCIPT</title>

<script type="text/javascript" src="4a.js">

</script>

</head>

<body>

<h1 align="enter">PROGRAM ON JAVASCRIPT</h1>

<form action="">

<p align="center"><br /><br /><br />

<label><b>
ENTER THE USN:</b>

<input type="text" name="usn" size="15" maxsize="15" id="usn" />

</label>

<input type="button" value="SUBMIT" onclick="validate();"/>

<input type="reset" value="RESET"/>

</p>

</body>

</html>



4a.js:

function validate()

{

var myusn=docum
ent.getElementById("usn");

var pos=myusn.value.search(/^[1
-
4][A
-
Z][A
-
Z]
\
d{2}[A
-
Z][A
-
Z]
\
d{3}$/);

if(pos!=0)

{

alert("error");

myusn.focus();

myusn.select();

return false;

}

else

{

alert("error");

myusn.focus();

myusn.select();

return true;

}

}

4b) Modify the above program to get the current semester also (restricted to be a number

from 1 to 8)


<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>JAVASRCIPT</title>

<script type="text/javascript" src="4
b
.js">

</script>

</head>

<body>

<h1 al
ign="enter">PROGRAM ON JAVASCRIPT</h1>

<form action="">

<p align="center"><br /><br /><br />

<label><b>ENTER THE USN:</b>

<input type="text" name="usn" size="15" maxsize="15" id="usn" />

</label>

<input type="button" value="SUBMIT" onclick="validate();"/>

<input type="reset" value="RESET"/>

</p>

</body>

</html>



4b.js:


function validate()

{

var dom=document.getElementById("usn");

var flag=dom.value.search(/^[1
-
4][A
-
Z][A
-
Z]
\
d{2}[A
-
Z][A
-
Z]
\
d{3}$/);

var d=document.getElementById("sem");

var f=d.value.search(
/^[1
-
8]$/);

if(flag!=
-
1)

alert("VALID USN");

else

alert("NOT A VALID USN");

if(f!=
-
1)

alert("VALID SEMESTER");

else

alert("NOT A VALID SEMESTER")

}



5a) Develop and demonstrate, using
JavaScript

script, a XHTML document that contains three
short paragraphs of text, stacked on top of each other, with only enough of each showing so
that the mouse cursor can be placed over some part of them. When the cursor is placed
over the exposed
pa
rt of any

paragraph,
it should rise to the top to

become completely
visible.


<html xmlns= "http://www.w3.org/1999/xhtml">

<head>


<title>Stacking</title>

<script type="text/javascript" src="5a.js">

</script>

<style type="text/css">

.plane1{position:abso
lute;top:0;left:0;z
-
index:0;background
-
color:red;text
-
align:justify;font
-
size:24px;font
-
weight:bold;}

.plane2{position:absolute;top:70px;left:110px;z
-
index:0;background
-
color:blue;text
-
align:justify;font
-
size:24px;font
-
weight:bold;}

.plane3{position:absolu
te;top:110px;left:220px;z
-
index:0;background
-
color:yellow;text
-
align:justify;font
-
size:34px;font
-
weight:bold;}

</style>

</head>

<body bgcolor="cyan">


<textarea class="plane1" id="para1" rows="3" cols="40"
onmouseover="toTOP('para1')">ACER</textarea>

<tex
tarea class="plane2" id="para2" rows="3" cols="40"
onmouseover="toTOP('para2')">DELL</textarea>

<textarea class="plane3" id="para3" rows="3" cols="40"
onmouseover="toTOP('para3')">COMPAQ</textarea>

</body>

</html>



5a.js:

var top="para1";

function
toTOP(newtop)

{

var domtop=document.getElementById(top).style;

var domnew=document.getElementById(newtop).style;

domtop.zIndex="0";

domnew.zIndex="10";

top=document.getElementById(newtop).id;

}



5b) Modify the above document so that when a paragraph is mo
ved from the top stacking
position, it returns to its original position rather than to the bottom.


<html xmlns= "http://www.w3.org/1999/xhtml">

<head>


<title>Stacking</title>

<script type="text/javascript" src="5b.js">

</script>

<style type="text/css">

.plane1{position:absolute;top:0;left:0;z
-
index: 1;background
-
color:red;text
-
align:justify;font
-
size:24px;font
-
weight:bold;}

.plane2{position:absolute;top:70px;left:110px;z
-
index: 2;background
-
color:blue;text
-
align:justify;font
-
size:24px;font
-
weight:bold;}

.plane3{position:absolute;top:110px;left:220px;z
-
index: 3;background
-
color:yellow;text
-
align:justify;font
-
size:34px;font
-
weight:bold;}

</style>

</head>

<body bgcolor="cyan">


<textarea class="plane1" id="para1" rows="3" cols="40"
onmouseover="toTOP('para1','1')" onmouseout="mback()">ACER</textarea>

<textarea class="plane2" id="para2" rows="3" cols="40"
onmouseover="toTOP('para2','2')" onmouseout="mback()">DELL</textarea>

<textarea class="plane3" id="para3" rows="3" cols="40"
onmous
eover="toTOP('para3','3')"
onmouseout="mback()">COMPAQ</textarea>

</body>

</html>


5b.js:


var top="para1";

var orgpos;

function toTOP(newtop, pos)

{

var nt=document.getElementById(newtop).style;

nt.zIndex="10";

top=document.getElementById(newtop).id;

orgp
os=pos;

}

function mback()

{

document.getElementById(top).style.zIndex=orgpos;

}



6. a) Design an XML document to store information about a student in an engineering

college affiliated to VTU. The information must
include USN, Name, Name of

the

College
, Brach, Year of Joining, and

e
-
mail id. Make up sample
data for 3

students

Create a CSS style sheet and use it to display the document.
[.xml]

<?xml version="1.0" encoding="UTF
-
8"?>

<!DOCTYPE student[

<!ELEMENT student_info (ad)* >

<!ELEME
NT ad (usn, name, college, brch, year, emid)>

<!ELEMENT usn (#PCDATA)>

<!ELEMENT name (#PCDATA)>

<!ELEMENT college (#PCDATA)>

<!ELEMENT brch (#PCDATA)>

<!ELEMENT year (#PCDATA)>

<!ELEMENT emid (#PCDATA)>

]>

<?xml
-
stylesheet type="text/css" href="6a.css"?>

<student_info>

<ad>

<usn>74447</usn>

<name>shashi</name>

<college>mce</college>

<brch>cse</brch>

<year>1992</year>

<emid>hvs@mcehassan.ac.in<
/emid>

</ad>

<ad>

<usn>mca1</usn>

<name>ravi</name>

<college>mce</college>

<brch>mca</brch>

<year>2002</year>

<emid>ravi@mcehassan.ac.in</emid>

</ad>

<ad>

<usn>mca2</usn>

<name>roopa</name>

<college>mce</college>

<brch>mca</brch>

<year>2003</year>

<emid>
roopa@mcehassan.ac.in</emid>

</ad>

</student_info>




6a.css:

usn,name,college,brch,ye
ar,emid

{

display:block;

font
-
family:arial;

color:blue;

font
-
size:12pt;

}


6b)
create

an XSLT style sheet for one student element of the above document and use it to
create a display of that element.

<?xml version="1.0" encoding="UTF
-
8"?>

<?xml
-
stylesheet type="text/xsl"
href="6b.xsl"?>

<student>

<p
-
det>

<usn>74447</usn>

<name>shashi</name>

<college>mce</college>

<brch>cse</brch>

<year>1992</year>

<emid>hvs@mcehassan.ac.in</emid>

</p
-
det>

</student>

6b.xsl:

<?xml version="1.0" encoding="ISO
-
8859
-
1"?>

<xsl:stylesheet versio
n="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns="http://www.w3.org/1999/xhtml">

<xsl:template match="/">

<html>

<body>

<h2> student data</h2>

<table border="1">

<tr>

<th>usn</th>

<th>name</th>

<th>college</th>

<th>branch</th>

<th>year</th>

<
th>e
-
id</th>

</tr>

<xsl:for
-
each select="student/p
-
det">

<tr>

<td><xsl:value
-
of select="usn"/></td>

<td><xsl:value
-
of select="name"/></td>

<td><xsl:value
-
of select="college"/></td>

<td><xsl:value
-
of select="brch"/></td>

<td><xsl:value
-
of select="year"/></t
d>

<td><xsl:value
-
of select="emid"/></td>

</tr>

</xsl:for
-
each>

</table>

</body></html>

</xsl:template>

</xsl:stylesheet>

7a) Write a Perl program to display
the
various Server Information like Server Name, Server

Software, Server protocol, CGI Revision
etc.



#!/usr/bin/perl

print "Content
-
type:text/html
\
n
\
n",

"<html xmlns='http://www.w3.org/1999/xhtml'>
\
n",

"<head><title>ABOUT SERVER</title></head>
\
n",

"<body bgcolor=cyan><p><br /><br /><b>
\
n";

print "server name:",$ENV{'SERVER_NAME'},"<BR >","
\
n";

prin
t "running on port:",$ENV{'SERVER_PORT'},"<BR >","
\
n";

print "server software:",$ENV{'SERVER_SOFTWARE'},"<BR >","
\
n";

print "server protocol:",$ENV{'SERVER_PROTOCOL'},"<BR >","
\
n";

print "cgi revision:",$ENV {'GATEWAY_INTERFACE'},"<BR >","
\
n";

print "<
/body></html>","
\
n";


7b) Write a Perl program to accept UNIX command from a HTML form and to display

the
output of the command executed.


<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>commands</title>

</head>

<body>

<form action =
"http://192.168.7.50/hvs/cgi
-
bin/pgm7b.pl"
method="get">

<input type type="text" name= "t1" /> <br />

<input type="submit" value="command" />

</form>

</body>

</html>



Pgm7b.pl:


#!/usr/bin/perl

print "Content
-
type: text/html
\
n
\
n",

"<html xmlns='http://w
ww.w3.org/1999/xhtml'>
\
n",

"<head><title>command</title></head><body><p>
\
n";

use CGI ':standard';

my $cmd= param('t1');

$re=`$cmd`;

print "<h1>result </h1> <br /> $re <br /> </p></body></html>"



8. a) Write a Perl program to accept the User Nam
e and display a greeting message

randomly chosen from a list of 4 greeting messages.

<?xml version ="1.0"encoding="utf
-
8"?>

<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>message</title>

</head>

<body>

<form action = "F:
\
MCA
\
Web
exe
\
pgm8a.pl" method="get">

<input type type="text" name= "t1" /> <br />

<input type="submit" value="message" />

</form></body></html>

Pgm8a.pl:

#!/usr/bin/perl

print "Content
-
type: text/html
\
n
\
n",

"<html xmlns='http://www.w3.org/1999/xhtml'>
\
n",

"<head>
<title>greet</title></head><body><p>
\
n";

$query_string=$ENV{'QUERY_STRING'};

($field_name,$command)=split(/=/,$query_string);

($sec,$min,$hor)=localtime(time);

if($hor>=12)

{

$hor
-
=12;

$ampm="pm";

if($hor>5 && $hor<8)

{

print"$command : good evening";

}

el
sif($hor>1 && $hor<5)

{

print "$command : good after noon";

}

else

{

print "$command : good night";

}

}

else

{

$ampm="am";

print "$command : good morning";

}

if($hor==0)

{

$hor=12;

print"$command : good noon";

}

print "</p></body></html>"

8b) Write a Perl program to keep track of the number of visitors visiting the web page and

to display this count of visitors, with proper headings.


<?xml version='1.0' encoding='utf
-
8'?>

<!DOCTYPE html PUBLIC '//w3c//dtd XHTML 1.1//EN'
http://www.w3.org/
PR/xhtml11/DTD/xhtml11.dtd'>

<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>sequence</title></head>

<body>

<form action="http://192.168.7.50/mca68/cgi
-
bin/p8b.pl" method="get">

<input type="text" name="t1" /><br />

<input type="submit"
value="message"/>

</form>

</body>

</html>


P8b.pl:


#!/usr/bin/perl

open(CT, " < /home/hvs/public_html/cgi
-
bin/a.txt") or die "cant open
a.text: $!";

$n=<CT>;

close(CT);

$n++;

open(CT,"> /home/hvs/public_html/cgi
-
bi/a.txt") or die "cant open
a.text for out
: $!";

print CT $n;

close(CT);

print "Content
-
type: text/html
\
n
\
n",

"<html xmlns='http://www.w3.org/1999/xhtml'>
\
n",

"<head><title>about counter</title></head><body><p>
\
n";

print "YOU ARE THE VISITOR NUMBER : " , $n;

print "</p></body></html>";




note:create a.txt and insert 0 in tat



9. Write a Perl program to display a digital clock which displays the
current time of the server.


#!/usr/bin/perl

($second,$minute,$hour)=localtime(time);

if($hour>12)

{

$hour
-
=12;

$ampm="pm";

}

else

{

$ampm="am";

}

if($hour==0)

{

$hour=12;

}

$time=sprintf("%02d:%02d:%02d%s
\
n",$hour,$minute,$second,$ampm);

print "Content
-
type: text/html
\
n
\
n",

"<html xmlns='http://www.w3.org/1999/xhtml'>
\
n",

"<head><title>about server</title></head><body<p>
\
n";

print "current time "
, $time;

print "</p></body></html>","
\
n";



10. Write a Perl program to insert name and age information entered by the user into a table

created using MySQL and to display the current contents of this table.


<html xmlns="http://www.w3.org/1999/xhtml">

<
head><title>program 10</title></head>

<body>

<form action="http://192.168.7.50/~hvs/cgi
-
bin/pgm10.pl">

<label>name: <input type="text" name="t1" /></label><br />

<label>age : <input type="text" name="t2" /></label><br/>

<input type="submit" value="print"/>

</form>

</body>

</html>



pgm10.pl:


#!/usr/bin/perl

print "Content
-
type:text/html
\
n
\
n",

"<html xmlns='http://www.w3.org/1999/xhtml'>
\
n",

"<head><title>name age</title></head>
\
n",

"<body bgcolor=cyan><br /><br /><b>";

use DBI;

use CGI':standard';

my
($fn,$age);

my $amper;

my $field;

my $query_string;

my $ENV;

$fn= param('t1');

$age= param('t2');

my $dbh=DBI
-
>connect('DBI:mysql:mca34','mca34','mca2009') or die"cannot connect to
sql".DBI
-
>errstr();

my $sth=$dbh
-
>prepare('insert into agn(na,ag) values(?,
?)') or die"cannot prepare".$dbh
-
>errstr();

$sth
-
>execute($fn,$age) or die"cannot execute".$sth
-
>errstr();

$sth=$dbh
-
>prepare('select * from agn') or die "cannot prepare".$dbh
-
>errstr();

$sth
-
>execute() or die "cannot execute".$sth
-
>errstr();

while(($fn,$a
ge)=$sth
-
>fetchrow())

{

print "$fn
\
t$age <br />
\
n";

}

$sth
-
>finish();

$dbh
-
>disconnect();

print "</body></html>";



11. Write a PHP
program to

store
current date
-
time in

a COOKIE and
display the ‘Last

visited
on’ date
-
time on the web page upon reopening of the same page.


<?

$dt=date("l,F,j,Y");

$ti=date('g:i A');

if(strcmp($_COOKIE[lvs],"") == 0)

{


$lst="";

}

else

{


$lst=$_COOKIE[lvs];

}

$lv = $dt . " at " . $ti;

setcookie("lvs",$lv,time()+86400);

?
>

<html>

<head><title>visitors</title></head>

<body>

<?

print "@@@@@@@@@@@@@@@@@@@@
\
n";

if ($lst == "")


print "<h3> u hav visited first time</h3>";

else


print "<h3>$lst</h3>";

?>

</body></html>






Save with
Ext:

.php



12. Write a PHP program to
store page views count in SESSION, to increment the count on

each refresh, and to show the count on web page.


<?

session_start();

session_register("count");

if(!isSet($_SESSION))


{


$_SESSION["count"]=0;


echo "<p> counter initialised</p>
\
n ";


}

else


{


$_SESSION["count"]++;

}

echo "<p>The counter is now $_SESSION[count]</p>",

"<p>Reload the page to increement</p>";

?>



13a and 13b). Create a XHTML form with Name
, Address

Line 1
, Address

Line 2
, and

E
-
mail
text

fields. On submitting
, store

the valu
es in MySQL table. Retrieve and display the data

based on Name.


<html xmlns="http://www.w3.org/1999/xhtml">

<head><title>program 13</title></head>

<body>

<form action="http://192.168.7.50/hvs/cgi
-
bin/pgm13a.pl">

<label>name</label><input type="text"
name="t1" /><br />

<label>address1</label><input type="text" name="t2"/><br/>

<label>address2</label><input type="text" name="t3"/><br/>

<label>emailid</label><input type="text" name="t4"/><br/>

<input type="submit" value="insert"/><br /><br />

</form>

</b
ody>

</html>



pgm13a.pl:


#!/usr/bin/perl

print "Content
-
type:text/html
\
n
\
n",

"<html xmlns='http://www.w3.org/1999/xhtml'>
\
n",

"<head><title>address</title></head>
\
n",

"<body bgcolor=cyan><p><br/><br/><b>
\
n";

use DBI;

use CGI':standard';

my
($fn,$ad1,$ad2,$e);

$fn= param('t1');

$ad1= param('t2');

$ad2= param('t3');

$e= param('t4');

my $dbh=DBI
-
>connect('DBI:mysql:mca35','mca35','mca2009') or die "cannot connect to
sql".DBI
-
>errstr();

my $sth=$dbh
-
>prepare('insert into detail(name,addr1,addr2,
email) values(?,?,?,?)') or
die"cannot prepare".$dbh
-
>errstr();

$sth
-
>execute($fn,$ad1,$ad2,$e) or die"cannot execute".$sth
-
>errstr();

print "record inserted<br/>
\
n";

$sth
-
>finish();

$dbh
-
>disconnect();

print "</p></body></html>"



13b)


<html xmlns="http:
//www.w3.org/1999/xhtml">

<head><title>program 13</title></head>

<body>

<form action="http://192.168.7.50/mca68/cgi
-
bin/pgm13b.pl">

<label>Name</label><input type="text" name="t1" /><br />

<input type="submit" value="search"/>

</form>

</body>

</html>


pgm1
3b.pl:



#!/usr/bin/perl

print "Content
-
type:text/html
\
n
\
n",

"<html xmlns='http://www.w3.org/1999/xhtml'>
\
n",

"<head><title>search</title></head>
\
n",

"<body bgcolor=cyan><p><br/><br/><b>
\
n";

use DBI;

use CGI':standard';

my $fn;

$fn=param('t1');

my
$dbh=DBI
-
>connect('DBI:mysql:mca35','mca35','mca2009') or die "cannot connect to
sql".DBI
-
>errstr();

$sth=$dbh
-
>prepare("Select * from detail where name='$fn';") or die "cannot prepare".$dbh
-
>errstr();

$sth
-
>execute() or die "cannot execute".$sth
-
>errstr()
;

if(($fn,$ad1,$ad2,$e)=$sth
-
>fetchrow())

{


print "$fn
\
t$ad1
\
t$ad2
\
t$e<br/>
\
n";

}

else

{


print "not found<br/>
\
n";

}

$sth
-
>finish();

$dbh
-
>disconnect();

print "</p></body></html>";