
defroster
Members-
Posts
89 -
Joined
-
Last visited
Everything posted by defroster
-
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
-
Select entries from the past 36 hours -> now() but not in the future
defroster replied to defroster's topic in MySQL Help
Thanks. That worked well! -
Consideration with image uploading to website - pjpeg
defroster replied to defroster's topic in PHP Coding Help
so you don't think I need to adjust the script for pjpeg? Thanks, I appreciate the help -
Hello, I was thinking of using this image upload script on my website: http://www.white-hat-web-design.co.uk/blog/resizing-images-with-php/ The question I have are the following: - 1. Do I need to take in consideration the $type="image/pjpeg" on this script or would it work anyway? - 2. When is the pjpeg actually used, is it only on certain PC browsers. Where can I find info about this? Thanks, df
-
Problem solved. Finally. All I needed to do was to remove a specified height on a div I had within the div I wanted to expand. Thanks for helping out!
-
It's strange. I had simplified the code a bit and just taken the important parts, and when I used the code I uploaded here it seems to expand as well.. This is really doing my head in. Thanks for your help anyways
-
Hmm. Yes, I did remove the height... But I'll post the code here. Thanks for help!! The HTML <div class='main'> <div class='voting area'> <div class='title' align='center'>Vote</div> <div class='report'><a href="report_exe.php?v=7794" onclick="return popitup('report_exe.php?v=7794')">report</a></div> </div> <div class='video area'> <div class='title'>The ballerina dog</div> <div class='titletext'>Dog with a skirt</div> <img src='photo22'><br /> <div class='titletext'>Posted 2 months ago </div> </div> </div> The stylesheet .main { padding: 0px; margin-top: 20px; overflow:auto; border:1px dashed #000000; margin-bottom: 20px; width:620px; webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px; background-color: #f2f2f2; } .votingarea { float:right; height:130px; width:55px; margin-top:5px; margin-left:0px; margin-right:15px; border:0px dashed #000000; } .report{ float:right; height:50px; width:55px; margin-top:135px; margin-right:0px; border:0px dashed #000000; background-color: #f2f2f2; text-align: center; } .videoarea { padding-top: 0px; padding-bottom: 0px; float:left; width:530px; text-align:left; margin-left:15px; margin-top:10px;height:380px; border:0px solid #000000; font-weight:bold; font-size:18px; } .title { font-weight: bold; font-size: 18px; border:0px dotted #000000; } .titletextprofile { font-size: 14px; border:0px dotted #000000; } Thanks a million. Instead of a scrollbar in the 'main' div I would like it to expand?!?
-
Thanks for quick reply! The overflow made it possible to scroll within the div.. the div itself didn't expand ..
-
Hello, In my stylesheet I have the following: .main { padding: 0px; margin-top: 20px; height: 420px; border:1px dashed #000000; margin-bottom: 20px; width:620px; webkit-border-radius: 20px;-moz-border-radius: 20px;border-radius: 20px; background-color: #f2f2f2; } If I remove the height tag my div doesn't expand as the content fills it.. how can I make the height auto-resisze as content fills the div? Thanks /df
-
Search db - PHP SQL query shows more than desired results
defroster replied to defroster's topic in PHP Coding Help
That worked like a charm THANKS again