1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Number of views per video?

Discussion in 'Programming' started by hockeyhero, Dec 17, 2008.

  1. #1
    hockeyhero, Dec 17, 2008 IP
  2. it career

    it career Notable Member

    Messages:
    3,562
    Likes Received:
    155
    Best Answers:
    0
    Trophy Points:
    270
    #2
    Everytime someone clicks on the link view video , increment the some counter in database.
     
    it career, Dec 18, 2008 IP
    hockeyhero likes this.
  3. hockeyhero

    hockeyhero Well-Known Member

    Messages:
    853
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    120
    #3
    hmm... so does that mean that every time someone clicks the link, the link id goes into the database and everytime someone clicks it the counter goes up?

    what piece of code would work for that?

    thanks
     
    hockeyhero, Dec 18, 2008 IP
  4. hockeyhero

    hockeyhero Well-Known Member

    Messages:
    853
    Likes Received:
    25
    Best Answers:
    0
    Trophy Points:
    120
    #4
    bump.. anyone?
     
    hockeyhero, Dec 19, 2008 IP
  5. dcwilliam1

    dcwilliam1 Peon

    Messages:
    7
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    in all honesty, theres several ways to do this. . . we would need more information than you have provided.
    To give you a brief generalization of how I'd do it
    1. have a datgabase with a table row for each video. one of the entries in that table row would be "views"
    2. have a php script on the video page that retrieves that number when the video is viewed.
    3. increment that number
    4. update the database entry

    Like I said, you haven't given much information on the elements your working with or your level of experience, I hope I'm not insulting you with the rest of this list, but if you are not familiar, you need to get familiar with
    1. connect to the database
    2. query the database
    3. update the value
    4. set the value

    If you don't know how to do that, you'll have to study and get it. If someone gave you a script it would not be accurate, as to how each different database has a different way of connecting and shuffling values. Your script is specific to your database.

    There are other ways, such as an xml file, or even a simple data file. but that would get alot more complicated.
     
    dcwilliam1, Dec 19, 2008 IP