Seeking the Most Efficient Way

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • amykhar
    Senior Member
    • May 2001
    • 579
    • 3.5.x

    Seeking the Most Efficient Way

    On the ForumHome page, I need to display some information that I extract from my database.

    What is the most efficient way to do this?

    Amy
    http://www.eaforums.com
  • fury
    Senior Member
    • Jun 2001
    • 1464

    #2
    Assuming you're aware of how to make database queries in php, I am guessing it's as simple as adding the query commands to index.php (in the main forums folder) and using the variables that you assigned the queries to in the forumhome template.

    For instance, inserting this code (don't try this at home, kids, besides it's already in index.php ):

    $allpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] $ignoreusers");
    $newpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND dateline>$bbuserinfo[lastvisit] AND folderid=0 $ignoreusers");
    $unreadpm=$DB_site->query_first("SELECT COUNT(*) AS messages FROM privatemessage WHERE userid=$bbuserinfo[userid] AND messageread=0 AND folderid=0 $ignoreusers");

    and referring to the variables $allpm[messages] $newpm[messages] $unreadpm[messages] to get the information

    I hope this helps. I'm not too advanced in PHP/MySQL yet, but I try to help out wherever I can

    Comment

    widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
    Working...