Beefy Boxes and Bandwidth Generously Provided by pair Networks Ovid
"be consistent"
 
PerlMonks  

Re: How to access an Array Element

by SamCG (Hermit)
on Apr 04, 2006 at 17:10 UTC ( [id://541222]=note: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.


in reply to How to access an Array Element

Hmm, okay, you're using a database query method I'm not familiar with to get your array. If you were using something like:

while (my @row = $sth->fetchrow_array){@search=($row[2]);}
I'd understand a bit better. You specify in other post that your query only returns one row in this case, but what does your array look like if your query returns more than one row?

So, you use my @currentpoll = LSRfm::Database::Data->search(field => 'currentpoll'); to get your array. Does this technique fetch rows sequentially? If so, put your fetch into a loop and then use $row[2] to access the content field, pushing it into an array with push @search, $row[2] if you need to compile a list for your next function. Of course, you'll also be safe doing this if you're sure you'll always get one row (which is what the OP looked like), but in that case I'm not sure why you need the single field in an array (though you can still do it).

-----------------
s''limp';@p=split '!','n!h!p!';s,m,s,;$s=y;$c=slice @p1;so brutally;d;$n=reverse;$c=$s**$#p;print(''.$c^chop($n))while($c/=$#p)>=1;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://541222]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.