Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Shouldn't this sort be simple?

by jrsimmon (Hermit)
on Mar 03, 2010 at 22:39 UTC ( [id://826554]=note: print w/replies, xml ) Need Help??


in reply to Shouldn't this sort be simple?

Not elegant, but you get the idea...
##SELECT DATA FROM DATABASE AND FILL IT INTO A HASH $sth = $dbh->prepare("SELECT * FROM $table_POSTS WHERE Thread = '$Sent +Thread'"); $sth->execute(); $sth->bind_columns(\$THREADd, \$POSTd, \$FORUMd, \$USERNAMEd, \$CREATE +Dd, \$REPLIEDd, \$TITLEd,\$DRIFTd, \$LINKd, \$JPEGd, \$COMMENTSd, \$I +Pd, \$REMd, \$OFFENSIVEd ); while($sth->fetch()) { $view{$POSTd} = { 'thread' => $THREADd, 'post' => $POSTd, 'forum' => $FORUMd, 'username' => $USERNAMEd, 'created' => $CREATEDd, 'replied' => $REPLIEDd, 'title' => $TITLEd, 'drift' => $DRIFTd, 'link' => $LINKd, 'jpeg' => $JPEGd, 'comments' => $COMMENTSd, 'ip' => $IPd, 'rem' => $REMd, 'offensive' => $OFFENSIVEd }; my @array1; my @array2; ###PRINT THE POST NUMBERS ASCENDING foreach $view2 ( sort keys %view ) { #$POST = $view{$view2}->{'post'}; push @array1, $view{$view2}->{'post'}; unshift @array2, $view{$view2}->{'post'}; #print "$POST<br>"; } foreach my $value (@array1){ print "$value<br>"; } foreach my $value (@array2){ print "$value<br>"; }

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2025-02-08 03:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (95 votes). Check out past polls.