Thanks, I'm still trying (and failing)...
maybe it has something to do with the fact that "sid" is an integer, and
that I can't get wildcards to work.
For instance, this works from the command line:
mysql> select sid from slips;
this gets all the "sid"s, but if I try to do:
mysql> select sid from slips where sid=?;
or "" where sid='?';, sid=%; etc etc, I always
get "Empty set (0.00 sec)"
Is there a way of specifying the wildcard for integer fields?
Thanks, ck
On Wed, 28 Apr 1999, Vivek Khera wrote:
> >>>>> "CK" == Charles Kirby <kirbych@stripped>
> writes:
>
> CK> my $dbh = DBI->connect("DBI:mysql:$dbname", $dbuser, $dbpasswd)
> CK> or die "can't connect: $DBI::errstr\n";
>
> CK> my $query = <<"EOS";
> CK> SELECT sid
> CK> FROM slips
> CK> WHERE sid='1'
> CK> EOS
> CK> my $sth = $dbh->prepare($query) or die "can't prepare $query: ",
> CK> $dbh->errstr, "
> CK> \n";
> CK> $sth->execute($sid);
>
> If you want to pass a parameter to execute and have it that value
> filled into your SQL, then you need to use "placeholders" in your
> $query string. A place holder is nothing more than a ? symbol. I'm
> assuming to get the desired effect, you want to change
>
> sid='1'
>
> to
>
> sid=?
>
> and then re-try your program.
>
> CK> while(@row = $sth->fetchrow_array) {
> CK> print "@row\n";
> CK> }
>
>
> v.
>
> --
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Vivek Khera, Ph.D. Khera Communications, Inc.
> Internet: khera@stripped Rockville, MD +1-301-545-6996
> PGP & MIME spoken here http://www.kciLink.com/home/khera/
>