List:General Discussion« Previous MessageNext Message »
From:sungeiway Date:August 19 1999 7:32am
Subject:statement can't work
View as plain text  
The below script work well when i execute it.
But it won't work when i change the statement from 
$statement='select * from table';
to   $statement='select * from table where (id='12345') and
(email='email@stripped')';
Does anybody know the reason??Please give me any suggestion to overcome
it.Thanks.

#!c:\perl.exe
use CGI ':standard';
use DBI;
# you may need to change these values
$db_name =    'xxxx';
$user =      'xxxx';
$password =  'xxxx';
$hostname = 'xxxx';
print header();
$dbh = DBI->connect("DBI:mysql:$db_name:$hostname", $user, $password);     
unless ($dbh) {
     print "could not connect to database: $DBI::errstr\n";
     exit 1;}
$statement='select * from table';       ##############
                 $sth =$dbh->prepare( 
                        $statement
                        );
                 if ( !defined $sth ) {
                     die "Cannot prepare statement: $DBI::errstr\n";
                   }
                 $sth->execute;
                 while ( @row = $sth->fetchrow() ) {
                     print "Row returned: @row\n ";
                   }
                 $sth->execute;
                 $sth->finish;
$dbh->disconnect();
print "It works.<br>\n";
exit 0;

____________________________________________________________________
Get your own FREE, personal Netscape WebMail account today at http://webmail.netscape.com.
Thread
statement can't worksungeiway19 Aug
  • Re: statement can't workThimble Smith19 Aug
  • Re: statement can't workRonald Beck19 Aug