Re: Question about bind_param and Oracle
From: David N Murray (dmurray_at_jsbsystems.com)
Date: 07/16/04
- Next message: Ravi Kongara: "Re: Question about bind_param and Oracle"
- Previous message: alsalvo_at_sherwin.com: "RE: Question about bind_param and Oracle"
- In reply to: alsalvo_at_sherwin.com: "Question about bind_param and Oracle"
- Next in thread: Ravi Kongara: "Re: Question about bind_param and Oracle"
- Reply: Ravi Kongara: "Re: Question about bind_param and Oracle"
- Reply: Tim Bunce: "Re: Question about bind_param and Oracle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 16 Jul 2004 11:57:05 -0400 (EDT) To: alsalvo@sherwin.com
You can't use a parameter for the table name. You have to use dynamic sql
(i.e. put it in the $sql var before the prepare). There's no point in the
prepare if the DB can't even figure out what table is going to be hit.
This should be a FAQ, but I didn't see it in there.
hth,
dave
On Jul 16, alsalvo@sherwin.com scribed:
> Hi all,
>
> Hoping someone can help me out here.
>
> I'm trying to do the following using Oracle 9i and DBI:
>
> $table_name = "USERS";
>
> $sql = "SELECT COUNT(*) FROM ?";
>
> $sth = $dbh->prepare($sql);
>
> $sth->bind_param(1,$table_name);
>
> $sth->execute;
> .
> .
> .
> However, I'm getting an error about an invalid table name (I have verified
> that the table is valid and that I spelled it correctly).
>
> Is this even possible with Oracle and DBI?
>
> Please let me know.
>
> Thanks.
>
> Aaron Salvo
- Next message: Ravi Kongara: "Re: Question about bind_param and Oracle"
- Previous message: alsalvo_at_sherwin.com: "RE: Question about bind_param and Oracle"
- In reply to: alsalvo_at_sherwin.com: "Question about bind_param and Oracle"
- Next in thread: Ravi Kongara: "Re: Question about bind_param and Oracle"
- Reply: Ravi Kongara: "Re: Question about bind_param and Oracle"
- Reply: Tim Bunce: "Re: Question about bind_param and Oracle"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|