PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Roleigh Martin <rol at uhc dot com>
Subject: Re: Can someone share a web page/cgi/sybperl script to work with sybase?
Date: Dec 3 1998 12:23AM

Michael,

Could you also (beyond showing the html side showing how the CGI script gets
invoked) please show the login to the database and exit from the database
in the script?  (I see a username 'sa' below, but now place for the database
name and password nor server name (use phony password/etc of course)).

Thanks!

Roleigh

At 02:20 PM 12/02/1998 -0800, you wrote:
> > If I could see how the above is done, I could finish my task very 
> > fast--the above would be a fantastic example program.
>
>Here's one way - thrown together in about the time it takes to type it 
>in...
>
>Michael
>-- 
>
>#!/usr/local/bin/perl -w
>
>use strict;
>
>use Sybase::DBlib;
>use CGI;
>
>my $query = new CGI;
>
>my $state = $query->param('__state') || 0; # default to 0
>my $dbh = new Sybase::DBlib 'sa';
>
>print $query->header;
>print $query->start_html(title=>'Sysusers Query');
>if($state == 0) {
>    print "

A little sysusers query...

"; > my $data = $dbh->sql("select suid, uid, gid, name from sysusers", undef, >TRUE); ># print $query->start_form; > print "\n"; > my $first = 1; > foreach my $row (@$data) { > if($first) { > print "\n"; > foreach (sort keys(%$row)) { > print ""; > } > print "\n"; > $first = 0; > } > print "\n"; > foreach (sort keys(%$row)) { > if($_ eq 'name') { > print ""; > } else { > print ""; > } > } > print "\n"; > } > print "
$_
href=sysusers.cgi?__state=1&name=$row->{name}>$row->{$_}$row->{$_}
\n"; >} elsif($state == 1) { > my $name = $query->param('name'); > > my $data = $dbh->sql("select suid, name, environ from sysusers where >name='$name'"); > > print "Results:"; > print "\n"; > foreach my $row (@$data) { > print "\n"; > foreach (@$row) { > print "\n"; > } > print "\n"; > } > print "
$_
\n"; >} > >print $query->end_html; > > > > > > -- Roleigh Martin, Rt. MN012-N188 Opinions are mine not UHC | Software Engineer Consultant AT&T voice: (612) 992-4592| UHC, HealthCare System Services AT&T vmail: (612) 992-4592| 5901 Lincoln Drive FAX: (612) 992-7021| Edina MN 55436 Email: rol@.uhc.com| Y2k Page: http://ourworld.compuserve.com/homepages/roleigh_martin ( easy to remember alias is: http://webalias.com/roleigh ) (A Web Site that focuses on Y2k threat to core infrastructures.)