Whay this dont work ? 

 

################################################################### Code1

#!/usr/bin/perl -w

 

use strict;

use CGI qw(:standard);

use CGI::Carp;

use DBI;

 

my ($server, $sock, $host);

 

my $output = new CGI;

$server = param('server') or $server = '';

 

# Prepare the MySQL DBD driver

my $driver = DBI->install_driver('mysqlPP');

 

my @databases = $driver->func($server, '_ListDBs');  ### Here is stops
becose like they don't found _ListDBs

################################################################# End Code1 

 

But the my bigest problem is becose i can't get type of fild from Mysql thru
Perl. I wonth to make forms on the flay. This is my code :

 

 

################################################################# Code 2

#!/usr/bin/perl -w 

use DBI; 

 

#############################

### dela :Povezava na bazo 

### spremenljivke : 

$user="root"; 

$password=""; 

$database="sifranti"; 

$hostname="localhost"; 

$port=3306; 

### spremenljivke valiabilne : DNS,dbi,i,

###                            tables (tabele),

###                            numFilds (število polj),

###                            name (ime polja)

#############################

 

$DSN = "DBI:mysqlPP:database=$database;host=$hostname;port=$port"; 

my $dbh = DBI->connect($DSN, $user, $password) or die "Not able to Connect.
Check the UserName and Password"; 

 

### - ime tabel in wiev

my @tables = $dbh->tables();

 

IzdelajHtmlZ("halo.pl");

            

### Print 'em out

foreach $table ( @tables ) {

            print "<P> Table: $table\n"; # tabela

            

            ### polja v tabelah

            my $sth = $dbh->prepare("SELECT * FROM $table"); 

            $sth->execute; 

            $numFields = $sth->{'NUM_OF_FIELDS'}; # število poj

            print "<P> Polja : $numFields\n";

            

            

            ### - ime polj v tabeli

            for ( my $i=0; $i < $numFields; $i++ ) {

                        my $name = $sth->{NAME}->[$i] ;

                        #my $type = $sth->{TYPE}->[$i] ;
###################### This thinks not working whay ?

                        #my $scale = $sth->{SCALE}->[$i] ;
###################### This thinks not working whay ?

                        #my $precision = $sth->{PRECISION}->[$i] ;
###################### This thinks not working whay ?

                        #my $nullabele = $sth->{NULLABELE}->[$i] ;
###################### This thinks not working whay ?

                                                

                        print "<P> Polje: " ;

                        print "$name" ;

                        print "\n";

                        

                        ### input

                        print "<P>";

                        print "$name";

                        print ' <INPUT NAME="';

                        print "$name" ;

                        print '" TYPE=text SIZE="48">';

 

            }

 

print "\n";

print "<P><INPUT TYPE=submit> <INPUT TYPE=reset>" ;

print "</html>";

 

}

 

$dbh->disconnect; 

 

exit; 

 

##### Izdela začetni html ###

sub IzdelajHtmlZ 

{

my $vr = $_[0];

 

            print "<html>";

            print "<head>";

            print "Testiram";

            print "</head>";

            print "<body>";

            print '<FORM METHOD=POST ACTION="';

            print "$vr";

            print ">";

            

} # izdela zacetni HTML

################################################################# End of
Code 2

 

Thenks for help, Gregor

mailto:[EMAIL PROTECTED]



 

Reply via email to