#!/usr/bin/perl use CGI qw(:standard); use strict; use warnings; use DBI; print "Content-type:text/html\n\n"; my $i; my $dbh= DBI->connect('DBI:mysql:databasename','root','password'); my $sth=$dbh->prepare("select * from emp_info"); $sth->execute(); print "<html><head></head><body><form name=frm1><table border=1>"; while(my @arr=$sth->fetchrow_array()) { print "<tr><td>Id = $arr[$i]</td>"; print "<td>Name = $arr[$i+1]</td>"; print "<td>Age = $arr[$i+2]</td>"; print "<td>Salary = $arr[$i+3]<td></tr>"; } print "</table></form></body></html>";
In reply to Re: How to write a CGI program to fetch data from mysql database and show in the browser with values in the text field?
by sanku
in thread How to write a CGI program to fetch data from mysql database and show in the browser with values in the text field?
by sanjay nayak
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |