while ( $row = $st->fetchrow_hashref ) { if ( $host eq $row->{host} ) { exit 0; } }
Hello, with the above code i try not to log again the same visitor that refreshes my webpage. I just want to log him only the first time thet he enters my page. if he hits the submit button and index.pl runs again or he just refreshes his browser i do not want my code to log him again. so i used the above code.

But the problem as i have it now is that the current hostanme is checking against the whole mysal table trying to find the exact match, when i only want the current hostname trying to match the last record entered i the mysql table. Or perhaps you have some better idea to log the user once but not continiously if he reloads the index.pl. But if the user checks my page at another time then i want him to be logged again. I do not want to use session variables for that. Thank you.

In reply to logging the user once every session 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.