Jump to content

doddsey_65

Members
  • Posts

    902
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by doddsey_65

  1. I think the above errors have now been fixed. But it would be helpful if someone could make sure. does that mean you have tried registering. If so, let me know what username you would have used and ill see if you are registered. Thanks
  2. All of the above errors should now be fixed. Thanks
  3. Thanks for the help. I just recently uploaded a new core class aswell as a new language class, so there are still some things that need to be changed to accomodate the new classes.
  4. $row = mysql_fetch_assoc($sql); $day_records = $row['COUNT(*)']; or you could do: $sql = mysql_query("SELECT * FROM logg WHERE tid > " . date("Y-m-d")); $day_records = mysql_num_rows($sql);
  5. Thanks for your comments. Im glad you like to general design as that is one of the more important things.
  6. I have this code: preg_replace('|\@([a-zA-Z0-9\_\-]+)|sie', 'preg_link_query("\\1")', $str) which replaces anything with an "@" symbol infront of it with a link to the profile(using the preg_link_query). The problem is that it no longer works. An example of content on the current page is: @doddsey_65 hello Where @doddsey_65 would be replaced with the profile link. I have added more code to this as it's part of a bbparser. Could it be to do with the fact that when the parser replaces smilies like :@ it breaks this code? Just to clarify, nothing is replaced and a preg match reveals nothing. Thanks
  7. You could use a recursive function to get all of the parent categories and its children to the nth level, but that would be slow if you have loads of them. I suggest reading about the modified preorder tree traversal algorithm
  8. Im trying to set up and retrieve info based on an array. Basically a user chooses to show 1 topic from forum A and 4 topics from forum B the array $forums is $forums => Array (2) ( ['1'] = String(1) "2" ['4'] = String(1) "4" ) the key is how many topics they wish to retrieve and the value is the id of the forum. The results are ordered by newest(t.t_time_posted). So it should show 1 topic from the forum with an id of 2(A) and 4 topics from the forum with id of 4(B) It should also show the first post within the topics So i have ran this query to get their results: foreach($forums as $key => $val) { $sql = "SELECT f.f_name, t.t_name, t.t_time_posted, p.p_name, p.p_content FROM ".TBL_PREFIX."topics t LEFT JOIN ".TBL_PREFIX."forums f ON (t.t_fid = f.f_fid) LEFT JOIN ".TBL_PREFIX."posts p ON (p.p_tid = t.t_tid) WHERE t.t_fid = '$val' ORDER BY t.t_time_posted DESC LIMIT $key"; $sth = $db->prepare($sql); $sth->execute() or die($db->sthError($sth, $sql)); $r = $sth->fetchAll(); dump($r); foreach($r as $k => $v) { echo $r[$k]['t_name']; } } However this doesnt work well. It shows 4 posts from forum B instead of 4 topics, and doesnt show anything from forum A. Any ideas? EDIT: I added a GROUP BY t.t_name which shows the 4 topics from forum B but still nothing from forum A Tiredness(and stupidity) got the better of me on this one. I had previously deleted all topics from forum A and forgot, thats why there were no results.
  9. I am currently creating a new forum software called A Simple Forum. For the most part it is complete. I just need to finish off the admin section then I will be releasing the first beta to download. But before that I need to make sure everything works. So can you guys please test my site and let me know how things go. Thanks http://www.asimpleforum.co.uk/forum/
  10. Ive created a notice system which shows notices to the visitors of my forum. The thing is though I need a system where the logged in user can close the notice and not have it displayed again. What would be the best way to accomplish this? Would cookies be the best idea? Because that would mean setting a cookie for every notice that has been closed.As far as i can think of that's the only way. Any thoughts?
  11. if i were going towards html5 then i would need to use <meta charset=UTF-8">
  12. yes i have also included: <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
  13. I have specified the use of utf-8 encoding using: header('Content-type: text/html; charset=utf-8'); but when ever I try to print a foreign charcter like é i get a question mark in a diamond. Am i missing something? I have also set the language to french using <html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">
  14. I have a query which pulls profile posts. This query sorts them via the date they were posted DESC. So newest ones are on top. However is a post has a comment i display the comment under the post. but the comments under the post are all ordered by DESC since it is one query to pull all of them. How would I order the comments in the reverse? $sql = "SELECT f.*, u.u_uid, u.u_group_color, u.u_avatar FROM ".TBL_PREFIX."wall_feeds f JOIN ".TBL_PREFIX."users u ON (f.f_poster = u.u_username) WHERE f_uid = '$uid' AND f_pid = '$parent' ORDER BY f_time_posted DESC";
  15. I am working on a notice system which displays notices based on if their conditions have been met, but have run into a problem. The following shows this notice to a user who is logged in and posted more than one post: foreach($row as $key => $val) { $conditions[$key] = unserialize($row[$key]['n_conditions']); if($conditions[$key]['posts_more_than'] && (sessionsClass::$data['u_posts'] > $conditions[$key]['posts_more_than'])) { $notices[] = $row[$key]['n_content']; } but i also have a condition to show notices to users who are logged in whhich is done like so: foreach($row as $key => $val) { $conditions[$key] = unserialize($row[$key]['n_conditions']); if($conditions[$key]['posts_more_than'] && (sessionsClass::$data['u_posts'] > $conditions[$key]['posts_more_than'])) { $notices[] = $row[$key]['n_content']; } elseif($conditions[$key]['logged_in'] == 1 && logged_in(sessionsClass::$data['u_uid'])) { $notices[] = $row[$key]['n_content']; } as you can guess this doesnt work. because the user is logged in it displays both notices regardless of how many posts they have made. Anyone have any ideas on the best method to do this?
  16. Thanks for all your hard work, ive got it working now with: $sql = "SELECT COUNT(*), t_time_posted FROM ".TBL_PREFIX."topics GROUP BY MONTH(FROM_UNIXTIME(t_time_posted))"; $sth = $db->query($sql); $row = $sth->fetchAll(); $count = 0; foreach($row as $key => $val) { $datay[date('n',$row[$key]['t_time_posted'])-1] = $row[$key]['COUNT(*)']; $datax[] = date('M',$row[$key]['t_time_posted']); // should have 1 in may, 4 in july and 5 in august } for($i=1; $i<=12; $i++) { if(empty($datay[$i])) { $datay[$i] = 0; } } ksort($datay); //dump($datay); foreach($datay as $key => $val) { $labels[] = date("M", mktime(0, 0, 0, ($key))); }
  17. It prints out 3, because the topics in the database only span 3 months(may, july and august) Im thinking i may have to do somthing like a for loop to fill in the blanks but thats where im stuck $sql = "SELECT COUNT(*), t_time_posted FROM ".TBL_PREFIX."topics GROUP BY MONTH(FROM_UNIXTIME(t_time_posted))"; $sth = $db->query($sql); $row = $sth->fetchAll(); $count = 0; foreach($row as $key => $val) { $datay[$key] = $row[$key]['COUNT(*)']; $datax[$key] = date('M',$row[$key]['t_time_posted']); echo $key; // should have 1 in may, 4 in july and 5 in august }
  18. They arent being included. Even if there were no topics within a month i still want to display that month. For example the data i have so far is: May: 1 topic July: 4 topics Aug: 5 topics But i want to include June, march and april as this will make up 6 months back from the current month.
  19. thanks for the help so far, ive used this: $sql = "SELECT COUNT(*), t_time_posted FROM ".TBL_PREFIX."topics GROUP BY MONTH(FROM_UNIXTIME(t_time_posted))"; $sth = $db->query($sql); $row = $sth->fetchAll(); $count = 0; foreach($row as $key => $val) { $datay[] = $row[$key]['COUNT(*)']; //$datax[] = date('M',$row[$key]['t_time_posted']); // should have 1 in may, 4 in july and 5 in august } which works in the graph, but since im only getting dates from the time_posted, the months which have 0 topics are missed out. How would i go about including them?
  20. just the last 6 months. wouldnt i need to use FROM_UNIXTIME(t_time_posted)) since the dates are stored as UNIX timestamps?
  21. sure, here it is. hope you can help. [attachment deleted by admin]
  22. the goal is to select all topics grouped by the month they were posted in then take the amount in the month and add it to the datay array
  23. not really thats why im asking for help, ive spent hours on this now, ive tried to leave it and move on but i cant, its bugging me too much. The code you pointed out means if the date changes then run the code below.
×
×
  • 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.