Hello i have this code to select my visitor records from the most current one to the first one and it works cause iam ordering by id(as ti happens) desc.

Problem is that some records dont appear in the correct places because those users have visited my webpage more than once and their record has just been updated in the position that there were. How can i correct this? I hope i gave you to understand what i am trying to do. Actually then i tried to cahnge the msyql column of date fro m text to datetime but what i get is 00-00-00 00:00:00. What i want to display is:
if( $name eq 'showlog' ) { $select = $dbh->prepare( "SELECT * FROM guestlog ORDER BY date DESC +" ); $select->execute; print br; print table( {class=>'info'} ); while( $row = $select->fetchrow_hashref ) { print Tr( td( {width=>'35%', class=>'aquamarine'}, +$row->{host} ), td( {width=>'15%', class=>'white'}, +$row->{date} ), td( {width=>'45%', class=>'cyan'}, +$row->{passage} ), td( {width=>'5%', class=>'lime'}, +$row->{counter} ) ); } print '</table>';
but i cant get it working. its just dont ordering by right! iam gettign date as my $date = strftime( "%d %b, %H:%M", localtime );

In reply to Trying to order by date by Nik

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.