ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Php/Mysql processed twice..?

February 24, 2009 6:55am

Subscribe [2]
  • #1 / Feb 24, 2009 6:55am

    _Oli

    56 posts

    Hi all,

    Any of you come across this before? I have but can’t remember what the problem was and I can’t find any post on here about it…

    I have this in a page where youtube videos are embedded and I’m just counting the video views to later display in a “most popular videos” list… Althought it isn’t a major problem, this count doesn’t work as I hoped it would.

    It should take the current “view cout” add 1 to it and update the Db. Well, it pulls the “view count” properly but the increments are to say the least, random :ohh: 


    Any suggestions/better ways?

    Merci

    {if:elseif segment_2 !=''}
          <h2>{title}</h2>
    <p>      <? // This count views on videos<br />
            $entry_id = "{entry_id}";<br />
            $view_count = "{hmg_view_count}";<br />
            $query = "UPDATE x_weblog_data SET field_id_8 = $view_count + 1 WHERE entry_id = $entry_id";<br />
            $result = mysql_query($query); <br />
          ?><br />
          {/if}

  • #2 / Feb 24, 2009 8:18am

    _Oli

    56 posts

    Half answered my own question when discovering the {view_count_one} tag…

    Still adding 2 views each time I access the post…

    brb 😊

  • #3 / Feb 24, 2009 8:29am

    _Oli

    56 posts

    My mistake… it is working…

    Can you see, I just had a little conversation with myself here 😊

  • #4 / Feb 24, 2009 10:19am

    Sue Crocker

    26054 posts

    No worries. 😊 Glad things are working again. Don’t hesitate to post again as needed.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases