
defroster
Members-
Posts
89 -
Joined
-
Last visited
Profile Information
-
Gender
Not Telling
defroster's Achievements

Member (2/5)
0
Reputation
-
Select top two people with most submitted videos, where type=1
defroster replied to defroster's topic in MySQL Help
Thanks, solved now SELECT by_person, count(*) AS total FROM videos WHERE type = 1 GROUP BY by_person ORDER BY total DESC LIMIT 2 DEMO: http://sqlfiddle.com/#!2/b2916/22 -
Select top two people with most submitted videos, where type=1
defroster replied to defroster's topic in MySQL Help
Thanks Barand, but I would only like to select the count where type=1, how do I bake that in? -
Hello I have a table over videos submitted by people: id / by_person / type / title / ----------------------------------------- 1 | 3 | 1 | title1 | 2 | 4 | 1 | title2 | 3 | 3 | 1 | title3 | 4 | 4 | 2 | title4 | 5 | 3 | 1 | title5 | 6 | 6 | 2 | title6 | 7 | 6 | 2 | title7 | 8 | 4 | 2 | title8 | 9 | 3 | 1 | title9 | 10 | 4 | 1 | title10 | 11 | 4 | 1 | title11 | 12| 3 | 1 | title12 | How do I SELECT the top 2 people who have submitted the most videos with type=1 ? So I get a presentation like this: 1. Person(3) - 5 videos 2. Person(4) - 3 videos Thanks
-
Thanks, I have looked everywhere but unable to find any tutorial, any ideas where to find one?
-
Hello, I am trying to create approve/reject buttons that will dynamically update (and change a value in a database). I am using php and mysql. Does anyone know of a tutorial? I have looked everywhere. Thanks
-
Thanks for help!
-
I have a jQuery accordion that breaks when I need to place a div-tag in one of the sliding open areas.. How do I get around this? I need to put a div-tag since I cannot make a nice box out of a span-tag. Anyone knows a way around this?? Please see my demo here to see where it breaks http://jsfiddle.net/zRqYM/
-
Loop through and enter <br /> when new day
defroster replied to defroster's topic in PHP Coding Help
Thanks a million! You are the man -
Loop through and enter <br /> when new day
defroster replied to defroster's topic in PHP Coding Help
Thanks for answer. I have been looking into these but cannot fully grasp it.. is there any way I can use code like this? But instead specify if the date is the same, regardless of time.. if ($row['date'] != $previousloopdate){ echo "<br /><br />"; } -
Hello, I have a database where each post has a corresponding date/time: DATABASE Post 1. 2012-08-12 18:20:15 Post 2. 2012-08-12 16:30:00 Post 3. 2012-08-11 18:20:15 Post 4. 2012-08-10 13:20:30 When looping through and showing the results I want to put a <br /><br /> when there is a new day , but how do I do this? I can only separate them if the the exact time is same on all posts... if ($row['date'] != $previousloopdate){ echo "<br /><br />"; } Thanks
-
Hello, I am using a hide/show system which is displaying youtube videos. I would like the youtube video to STOP whenever the div is closed. How do I do this? Thanks for help. Online demo: http://defroster.99k.org/layers.php <!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> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Slide</title> <style> body{ font-family:Verdana, Geneva, sans-serif; font-size:14px;} #slidingDiv, #slidingDiv_2, #slidingDiv_3{ height:300px; background-color: #99CCFF; padding:20px; margin-top:10px; border-bottom:5px solid #3399FF; display:none; } </style> </head> <body> <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js" type="text/javascript"></script> <script src="incl/showHide.js" type="text/javascript"></script> <script type="text/javascript"> $(document).ready(function(){ $('.show_hide').showHide({ speed: 500, // speed you want the toggle to happen easing: '', // the animation effect you want. Remove this line if you dont want an effect and if you haven't included jQuery UI changeText: 1, // if you dont want the button text to change, set this to 0 showText: 'View',// the button text to show when a div is closed hideText: 'Close' // the button text to show when a div is open }); }); </script> <a href="#" class="show_hide" rel="#slidingDiv">View</a><br /> <div id="slidingDiv"> <iframe width="560" height="315" src="http://www.youtube.com/embed/w68qZ8JvBds" frameborder="0" allowfullscreen></iframe> </div> <a href="#" class="show_hide" rel="#slidingDiv_2">View</a><br /> <div id="slidingDiv_2"> <iframe width="560" height="315" src="http://www.youtube.com/embed/B9tNGEt6rmE" frameborder="0" allowfullscreen></iframe> </div> <a href="#" class="show_hide" rel="#slidingDiv_3">View</a><br /> <div id="slidingDiv_3"> <iframe width="420" height="315" src="http://www.youtube.com/embed/eW5yWUKDMpg" frameborder="0" allowfullscreen></iframe> </div> </div> </body> </html>
-
Time ago function always referring to January 1st 1970
defroster replied to defroster's topic in PHP Coding Help
Thanks. This did it. timeAgo(strtotime($row['dateposted'])) -
Hello, When I use this function, the time always refers to January 1st 1970 ?! How come? I get the output '4 decades 1 year 11 months' regardless of which date I enter into the function.. ? function timeAgo($tm,$rcs = 2) { $cur_tm = time(); $dif = $cur_tm-$tm; $pds = array('second','minute','hour','day','week','month','year','decade'); $lngh = array(1,60,3600,86400,604800,2630880,31570560,315705600); for($v = sizeof($lngh)-1; ($v >= 0)&&(($no = $dif/$lngh[$v])<=1); $v--); if($v < 0) $v = 0; $_tm = $cur_tm-($dif%$lngh[$v]); $no = floor($no); if($no <> 1) $pds[$v] .='s'; $x=sprintf("%d %s ",$no,$pds[$v]); if(($rcs > 0)&&($v >= 1)&&(($cur_tm-$_tm) > 0)) $x .= timeAgo($_tm, --$rcs); return $x; } When I call for the function I use this: timeAgo($row['dateposted']) The format in the database for 'dateposted' is: 2006-08-14 23:29:23 Any ideas what I am doing wrong? Thanks a million
-
Ok, thanks for reply. The code is: $sql = "Select videos.*, categories.cat FROM videos, categories WHERE videos.cat_id = categories.id AND videos.status =1 AND videos.dateposted <= now() ORDER BY dateposted DESC LIMIT $start, $limit"; And the format of the table in the database is 'datetime' and the value stored looks like this: 2011-12-06 12:53:32 Thanks for help
-
Hello, I am a bit puzzled If I schedule a post to show on my website at exactly time 10:00:00 the post will only show when the time hits 10:00:24 = 24 seconds late!! Any ideas why the post always will show with a 24 second delay? Is there one time for the apache server and one time for the mySQL server? If that is the case, how can I sync them? - I have tried restarting the server and there was no change.. Thanks a million /df