The prepare will fail.  The db needs to know which column you want to
update.

You could do something like:

my $sql = qq {UPDATE table SET $column = ? WHERE id=?};
$dbh->prepare($sql);
$dbh->execute($value, $id);

Cheers
Tony



                                                                                       
                                                       
                      [EMAIL PROTECTED]                                                
                                                 
                      Selenia.com                    To:       [EMAIL PROTECTED]       
                                                      
                                                     cc:                               
                                                       
                      06.07.2004 08:33               Subject:  binding column names    
                                                       
                                                                                       
                                                       
                                                                                       
                                                       




Hi everybody,

what I want to do is something like

$dbh->prepare('UPDATE table SET ? = ? WHERE id=?');
$dbh->execute($column,$value, $id);

The encountered problem relates to the bind-process of $column.
As I suppose I have to explicitly call the bind_param-method the tell the
driver not to quote the column-name.
Is that right? Which kind of SQL-type do I have to assign to it?

Thank You.

G�nter B�hrle



Reply via email to