Jump to content

gausie

Members
  • Posts

    40
  • Joined

  • Last visited

    Never

Everything posted by gausie

  1. SELECT E1.name AS name, E1.id AS id, E2.name AS parentname FROM categories AS E1 INNER JOIN categories AS E2 ON E1.parent_id = E2.id WHERE E2.parent_id = '0' ORDER BY E1.amount ASC So I want to limit the results from E1 (for each E2 record) to 5 only How can I do that? Gausie
  2. <script type="text/javascript"> function scrollPosition(){ if (navigator.appName == "Microsoft Internet Explorer"){ return document.body.scrollTop; }else{ return window.pageYOffset; } } function dirScrolling(prev) { var current = scrollPosition(); if (prev > current){ document.getElementById('c').innerHTML = "V"; }else if (prev < current){ document.getElementById('c').innerHTML = "^"; }else{ document.getElementById('c').innerHTML = "="; } t = setTimeout(dirScrolling(current),500); } </script> Why does this not change the div when I scroll?
  3. If I'm updating the innerHTML of a div from an AJAX call, how can I make the new content fade in rather than just appear? And I need to do this so that it is cross-browser compatable gausie
  4. How can I make it discout the "WHERE comment NOT LIKE '<i>%</i>%' " if the amount of comments for this article is equal to 1? gausie
  5. SELECT mak.id,mak.name,mak.rating,mak.votes,mak.user,COUNT(comments.comment) AS num_comments FROM mak LEFT JOIN comments ON mak.id=comments.about GROUP BY mak.id ORDER BY num_comments DESC LIMIT 0,10 That query is selecting articles (in the table 'mak') based on how many comments (in the table 'comments') they have. However, I haven now implemented service comments and would like to discout them from the counting. Any service message is like this "<i>%</i>%" and since there is no other way of putting <i> into the comments field, I am sure that these are all service messages. How can I add this condition to the query I have above? gausie
  6. Wait no :-( I tried to add a WHERE clause to picking from the mak table. I want sometimes to select only the articles with the "type" column having then value "item". I tried adding a WHERE mak.type = "item", but I got an error in MySQL syntax Laasst piece of help?
  7. Thankyou for your amazing help! Topic solved
  8. And finally, could it give a count of the comments as well?
  9. I tried to do this myself but no luck - I want to select each article, ordered by the most recent comment, and I want to return information about that most recent comment for each article. How do I do that? gausie
  10. That works - excellent! One last question: SELECT mak.id,name,mak.user,comments.date,comments.user,num_comments FROM mak LEFT JOIN comments ON mak.id=comments.mak_id LEFT JOIN (SELECT mak_id,COUNT(comment) AS num_comments FROM comments GROUP BY about)AS cc ON mak.id=cc.mak_id ORDER BY comments.date; How can I make it only return one (the most recent) comment? gausie
  11. I need to select all rows in my table that are duplicates. But the classification of being duplicates are if they have any other rows with the same "user_id" and "item_id". Even if the other columns are different, it is still a duplicate if those two are the duplicated anywhere. Can someone help me with this query? gausie
  12. Thanks for your help so far, by the way, you've been excellent!
  13. That's "mak" (the articles table) -> FieldTypeCollationNullExtra idint(250)[/td]Noauto_increment namevarchar(250)latin1_swedish_ciNo infolongtextlatin1_swedish_ciNo typevarchar(250)latin1_swedish_ciNo uservarchar(250)latin1_swedish_ciNo ratingint(250)No votesint(250)No dateint(250)No That's "comments" -> FieldTypeCollationNullExtra idint(250)Noauto_increment commentlongtextlatin1_swedish_ciNo mak_idint(250)No uservarchar(250)latin1_swedish_ciNo dateint(11)No[td] Hope that's enough information! (and date means timestamp ) gausie
  14. What do you mean by "comment value"? gausie
  15. Thanks so much for that help! COUNT(comment) - what is this "comment" referring to? If my comments table is called "comments", should that be "COUNT(comments)"? gausie
  16. Hi all I have one table with a list of articles, and another with comments having an "article_id" to relate to which article they are about. How can I take the list of articles in order of how many comments there are? i.e. one with most comments comes out first etc. gausie
  17. Hmm would there be a way to dissect the gif, apply the change to each frame, and then output it with all these frames together? This, on the fly? gausie
  18. No, I'm making something that will be used on other people's websites :-(
  19. Hi there! I've got a couple of gifs that I'd like to randomly pick. I got that sorted with this: <?php $classes = array ("AT", "DB", "PM", "SC", "SR", "TT"); header("Content-Type: image/gif"); @readfile("./" . $classes[rand(0,5)] . ".gif") or die("File not found."); ?> However, it is now appropriate to overlay some text on each gif. So I tried this: <?php $classes = array ("AT", "DB", "PM", "SC", "SR", "TT"); $string = "Random Picture"; $chosen = "./" . $classes[rand(0,5)] . ".gif"; $im = imagecreatefromgif($chosen); $black = imagecolorallocate($im, 0, 0, 0); imagestring($im, 1, 0, 0, $string, $black); imagegif($im); imagedestroy($im); ?> But that's just giving me a text version of my GIF: So my problems here are Problem displaying the image I don't even know if it's working to overlay on every frame of the animation, since it wont display gausie
  20. i still can't get it to work - can anyone help?
  21. mail("gausie@mailinator.com", "Subject line", "Body here", "From: noreply@innerdreams.co.uk"); This is sending emails as being from apache@localhost.localdomain and also the emails are blocked by alot of sites. How can I fix this? gausie
  22. Thanks!! Of course, you only need to get the first one, then loop the days! Gausie
  23. How with mktime could I work out what the date of each Friday in a month was? Gausie
  24. Array ( [0] => 17:28 [1] => 17:40 [2] => 17:52 [3] => 18:04 [4] => 19:16 ) I know that 0 in the array is a value corresponding to the first Friday in this month, 1 to the second Friday etc.. I want to change the key to the UNIX timestamp of the day its referring to. Any help would be graciously appreciated Thanks Gausie
×
×
  • 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.