The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
This is my query
Code:
$boatbrands=$DB_site->query('select count(*)
AS countboats, field6 as boatbrands FROM userfield
WHERE field6 <> "n/a" AND field6 <> "n" AND field6 <> "none"
AND field6 <> "NA"
GROUP by field6
ORDER BY 1 DESC LIMIT 10');
The result is supposed to be 10 rows of 2 columns worth of data, but I can't figure out what I'm doing wrong here. |
|
#2
|
||||
|
||||
|
PHP Code:
|
|
#3
|
|||
|
|||
|
I've been using some examples in other php files and the PHP man to learn the output piece, but even though I think I've got that right, I'm still getting the Resource ID #38 error in the output. Where can I find what the error is really trying to tell me?
Here's what I'm using for the output Code:
while($boatbrand=$DB_site->fetch_array($boatbrands)) {
$boatbrand=$boatbrand["$boatbrands"];
}
|
|
#4
|
|||
|
|||
|
Forgot to say "thanks for the reply" in my other message. Here''s the whole piece which may help.
Code:
// ############ How many of each brand of boats
$boatbrands=$DB_site->query('select count(*)AS countboats, field6 as boatbrands FROM userfield
WHERE field6 <> "n/a" AND field6 <> "n" AND field6 <> "none" AND field6 <> "NA"
GROUP by field6
ORDER BY 1 DESC LIMIT 10');
while($boatbrand=$DB_site->fetch_array($boatbrands)) {
$boatbrands=$boatbrands["boatbrands"];
}
eval("dooutput(\"".gettemplate("boatstats_stats")."\");");
}
|
|
#5
|
||||
|
||||
|
use $boatbits in your boatstats_stats template
then change the code to: [code]while($boatbrand=$DB_site->fetch_array($boatbrands)) { eval("\$boatbits .= \"".gettemplate("boatbit")."\";"); }[/php] then create a new template called boatbit and there use the variable $boatbrand |
|
#6
|
|||
|
|||
|
Thanks again Xenon. The result is simply the word ARRAY.
![]() I'll keep tweaking. |
|
#7
|
|||
|
|||
|
GOT IT!!!
Xenon, many many thanks my friend. I was finally able to get it to display. I was, of course, doing a lot of things wrong and I sincerely appreciate your help. Here was went into the boatbit template: Code:
<tr align='center'>
<td bgcolor='{firstaltcolor}'>$boatbrand[countboats] - $boatbrand[boatbrands]</td>
</tr>
|
|
#8
|
||||
|
||||
![]() you're welcome |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|