Jump to content

sharpcode

Members
  • Posts

    15
  • Joined

  • Last visited

sharpcode's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Still cant seem to work it out. if i remove the ' ' around $video it doesnt update at all then...
  2. remarked as not solved because its playing up again... if(!session_is_registered($title)) { mysql_query("UPDATE videos SET views = views + 1 WHERE code = '$video'"); session_register($title); } not sure what the problem is and title is a variable edit: problem is like in the past doesn't update the view when i click on the page. But then when i refresh will skip any number (so far has been from 3 or even as high as 6)
  3. Problem was the site title inside the header for some reason not sure how to explain it. But updated it and changed the margin and it worked... i will try imitate the problem offline later for fun and see what the problem was exactly. Thanks for your help though L2c!
  4. the main problem is its making the header inside the wrapper longer and in turn is pushing the content down further. They float right i always had that from the start thats CSS 101. But just cant figure this little bug out. this is the header css... nothing that would make it resize so really confused if anyone has any idea or maybe a better way let me know otherwise ill post back when i find what this annoying little bug is -.- width: 940px; padding: 40px 10px 20px; background: url(../images/bgheader.png) bottom center no-repeat;
  5. 1 2 3 4 thats wha ti am aiming for. 3 divs then a footer (4) with 100% width. So 1 is left, 3 is centered so auto margin or whatever with 940px width and 3 is right.
  6. <body> <div id="left"> </div> <div id="right"> </div> <div id="wrapper"> <div id="header"></div> <div id="menu"></div> <div id="content"></div> </div> <div id="footer"> </div> </body> That is my structure at the moment. The footers width is 100%, the wrapper is 940px and centered int he middle of the screen. now i added the left and right div but they are pushing down the wrapper and making it look longer for some funny reason. Any help would be great
  7. sorry for this post but couldn't edit either of my last ones fro some reason... anyway i have done the following instead... $views = $row['views']; if(!session_is_registered($title)) { $views++; mysql_query("UPDATE videos SET views = $views' WHERE code = '$video'"); session_register($title); } echo $views; it seems to work except the first time i view the page it will update right but moment i go back or refresh it will return to the original value and stay that way. So a bit closer but also stranger edit: fixed... notive the ' after $views? well yeh i just did lol -.-
  8. Also how do i make the sessionname a variable like $code? because i am using the counter on other pages for other videos so it needs to be dynamic.. $_SESSION['.$title.'] didn't seem to work or even $_SESSION['title']
  9. if(!isset($_SESSION['viewed'])) { $views = $views + 1; mysql_query("UPDATE videos SET views = $views WHERE code = '$video'"); $_SESSION['viewed'] = 1; } Still seems to not be working. In the database i will check what one of the video pages is and say its 13 i will view it and it will still print 13. Then i refresh twice or so and it will turn into 15 and then wont change after that. Then once i move to another video page same thing. Edit: Putting session_start at the very start of the file worked by the way thanks Psycho.
  10. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <?php session_start(); $video = $_REQUEST['code']; error_reporting(E_ALL); //..... then rest of code thats the top of the file
  11. [b]Warning[/b]: session_start() [[url="http://dontstopdreaming.net/function.session-start"]function.session-start[/url]]: Cannot send session cookie - headers already sent by (output started at /home/public_html/video.php:5) in [b]/home/public_html/video.php[/b] on line [b]6[/b] [b]Warning[/b]: session_start() [[url="http://dontstopdreaming.net/function.session-start"]function.session-start[/url]]: Cannot send session cache limiter - headers already sent (output started at /home/public_html/video.php:5) in [b]/home/public_html/video.php[/b] on line [b]6[/b] its the first line as well... any ideas? looking at tutorials now and it seems i am doing it right and have no extra lines or anything...
  12. Do i have to start the session and end the session on every page of my site?
  13. mysql_query("UPDATE videos SET views = $views WHERE code = '$video'"); I need it to be called but only once a session per user. At moment if i refresh page it updates. Anyone able to assist me? First time i really am going to be using sessions now.
  14. I have a video section and what i want is to eventually add a sort by popular button so i am trying to track the views on each video. So i have videos.php which is the gallery page then video.php that has the content shown on it. What i need is for the 'views' column to be incremented for each 'videocode' that gets viewed. $video = $_REQUEST['code']; error_reporting(E_ALL); $con = mysql_connect("localhost","user","password") or die("Cannot connect"); mysql_select_db("my_db") or die(mysql_error()); $query = "SELECT * FROM videos WHERE code='$video' LIMIT 1"; $result = mysql_query($query,$con) or die("Result Query Error"); $row = mysql_fetch_array($result); // print out video and content here So i figure i need to use $video somehow i am a bit lost with how to get started. Because at the same time i need to use sessions possibly so it doesn't count spam clicks and so on. Any hints or links that can push me in the right direction i would be very happy
  15. Trying to workout how to design a navigation style page. Best example i have found would be like the video elements theme from this site http://wpbest.com/themes/press75/video-flick-20/ (click live demo test drive button then --> scroll down to video elements and click). My aim is to have similar system where it will post the first 12 images with what ever related data and then say there is 37 images there will be a nav at the bottom with links to page 1,2,3,4. i am fine with the printing out of the images and what not but i am confused with how to have it so if i click on the page 2, how to get it to reload the same page but with the next 12 results. I am hoping i don't have to have a different page. Minds half asleep it is probably not as hard as i am thinking it is lol any help or tips would be great! Thanks heaps in advance!
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.