Placeholders can't hold a table name or part of the query - these are
necessary in preparing. Placeholders can hold values. So your example is not
correct, but this would be:
$sth = $dbh->prepare("SELECT foo FROM table1 WHERE baz=?");
$sth->execute( 'hey' );
Does that make sense?
Steve H.
-----Original Message-----
From: Mortimer Hubin [mailto:[EMAIL PROTECTED]]
Sent: Saturday, October 13, 2001 11:25 PM
To: [EMAIL PROTECTED]
Subject: Execute with parameters ...
In the dbi description & help it is explicitely written this:
$sth = $dbh->prepare("SELECT foo, bar FROM table WHERE baz=?");
$sth->execute( $baz );
but i'm trying this, and it's not working ... Is there any reason ?
$sth = $dbh->prepare("SELECT foo FROM ? WHERE baz='hey'");
$sth->execute( 'table1' );
...
$sth->execute( 'table2' );
...
Thanks
Mortimer.