Thanks and Hi again,

Tried unescaping and got no joy so tried the following - still with no
joy -any suggestions as to which obvious thing I am missing.

#!/usr/bin/perl -w
#
# test script to query an mysql database
#
use strict;
use DBI;

my ( $dbh, $value1, $value2, $sth, @rows, $counter, $field_name, $field2, $field1);

print "Enter the first fieldname (field1)  : "; chomp ($field1 = <>);
print "enter the value for field one   : "; chomp ($value1 = <>);
print "Enter the second fieldname (field2)  : "; chomp ($field2 = <>);
print "enter the value for field two   : "; chomp ($value2 = <>);

$dbh = DBI -> connect ("DBI:mysql:ami","fgs") || die $DBI::errstr;

$sth = $dbh -> prepare( qq{select *  from testami where ? = ? and ? = ?});
$sth -> execute($field1, $value1, $field2, $value2);

#$sth -> execute();
$counter = "0";
while ( @rows = $sth  -> fetchrow_array())  {
    $counter++;
    print "@rows\n";
}
    print "Number of records  =  $counter\n\n";
$dbh -> disconnect;

Thanks

Francesco

Reply via email to