Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

(Boo) Re: Dereference an array reference

by boo_radley (Parson)
on Apr 19, 2001 at 00:46 UTC ( #73660=note: print w/replies, xml ) Need Help??


in reply to Dereference an array reference

my $slobbo = "select * from bleh where whatever = "; ... ... my $sth = $connection->connection->prepare($slobbo.$thangsname );
this is what placeholders were designed to do.
foreach my $var (@list) $sql = $l_dbh->prepare("INSERT activity (activity_num) VALUES (?)"); @l_sqlparams = ($var); $l_result=$sql->execute (@l_sqlparams) or die 'no';

see?

Replies are listed 'Best First'.
Re: (Boo) Re: Dereference an array reference
by fmogavero (Monk) on Apr 19, 2001 at 18:02 UTC
    This does help to clear things up. But at the same time it leaves a lot of questions.

    I am not trying to insert anything into the database. Where would I put the placeholder in a plain old select statement? || Can you direct me to a node with the answer?

    Does foreach my $var (@list); cause $var to be in list context? || Can you direct me to a node with a good explanation of the differences in context?

    Does @l_sqlparams = ($var); put $var back into an array from list context? || Can you direct me to a node with an explanation?

Re: (Boo) Re: Dereference an array reference
by fmogavero (Monk) on Apr 19, 2001 at 19:24 UTC
    Thank You! I wasn't understanding placeholders. Now I just have to figure out why I'm getting two error messages.
    1.) disallowed implicit conversion from datatype 'varchar' to datatype 'int'.
    After attempted adjustment
    2.) syntax error converting CHAR value 'ARRAY(XXXXXXX)' to an INT4 field
      It sounds like you're :
      1. stuffing non-integer values into an integer field.
      2. not deferencing the array.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://73660]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2021-04-15 06:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?