>
>database,sql,query,table
>Can someone please tell me why this won't work.
>
>if (defined($res)){
> my $stmt = qq{select distinct symbol from portfolio where $res};
> my $sth = $dbh->prepare($stmt);
> $sth->execute();
>
> my $portsymbols = "";
>
> while ($sth->fetchrow) {
> $portsymbols .= "'$_',";
> }
>
> # remove comma at the end
>
> $portsymbols =~ s/,$//;
> $portsymbols = "(".$portsymbols.")"; # close the symbol list with quote
> }
>
> # get the symbols
> $stmt = qq{select distinct p.symbol, i.name
> from portfolio p, stockinfo i
> where p.symbol = i.symbol };
> $stmt .= qq{and p.symbol in $portsymbols } if (defined($res));
> $stmt .= "order by symbol";
>
>Thanks.
>
>
>
>_________________________________________________________________
>Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.
>
>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php