![]() |
help fix this error...
first im not know much about code so maybe the code have a little strange....
ok here we go... i want to show the top poster in last week in my main page so i use this code in index.php PHP Code:
in forumhome.....when i goto my main page i found the error message in my header... Code:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/squawell/public_html/XXX/forum/index.php on line 61 while ($xxx=mysql_fetch_array($post7day)){ want help....thankz...... |
$DB_site->query_first never returns a mysql result, it returns a normal php array.
remove the _first to get it working.. edit: just the query before the while loop is meant ;) |
Quote:
but it only show up usernamethe post number did not below is the template in top_thread PHP Code:
|
$post7dayuser=$DB_site->query_first("SELECT username FROM user WHERE userid=$xxx[userid]");}
you jhust read out username, not posts here ;) |
Quote:
|
PHP Code:
Code:
<a href=member.php?s=$session[sessionhash]&action=getinfo&userid=$xxx[userid]>$post7day[username]</a><BR>$post7day[posts] |
Quote:
another question...if i want another code also use in same template should i put the code above this eval("\$topthread = \"".gettemplate("top_thread")."\";"); am i right? |
Xenon, how would you do this on a per forum type basis?
|
@squawell: yes right, every variabole appearing in the template has to be before that eval!
@boofo: it would slow down the query but i think this should do the trick: PHP Code:
|
Quote:
above ur code it will affect when u apply the code right?and the post number will recount after 7 days later is that right too?? :) |
Quote:
no the postnumber won't recount every 7 days, it will always be dynamical for the last seven days, so every day you'll see another value |
Quote:
so it cant count last 7 days the most posts user and change the stats every 7days later..... |
yes the code will work right.
nope every new day the value will be recalculated. it will not have weekly stats but stats the last 7 days |
Quote:
$d = mktime (0,0,0,date("m"),date("d")-7,date("Y")); if i want last 30 days should i change like this $d = mktime (0,0,0,date("m"),date("d")-30,date("Y")); is that right? |
exactly
|
Quote:
Database error in vBulletin 2.2.9: Invalid SQL: SELECT DISTINCT(post.userid), COUNT(postid) AS posts, user.username FROM post LEFT JOIN user USING(userid) LEFT JOIN thread USING(threadid) WHERE post.userid > 0 AND post.dateline>=1052895600 AND thread.forumid=34 GROUP BY post.userid ORDER BY posts DESC LIMIT 1 mysql error: Unknown column 'user.threadid' in 'on clause' mysql error number: 1054 Date: Wednesday 21st of May 2003 06:31:41 AM Script: http://www.bearfacts2.com/forum/foru...php?forumid=34 Referer: http://www.bearfacts2.com/forum/ Repair Report: This type of error cannot be automatically repaired. |
hmm than that way:
PHP Code:
|
That ran without any errors but it wouldn't show the stats.
|
Quote:
and it works..................... :D |
But it also should work in the forumdisplay.
|
All times are GMT. The time now is 01:16 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|