![]() |
Running a Query in a template
I'd like to have the value of a query (SELECT...) or a function from within a template. Where's the best place for me to put it?
Should I put it in the .php file that calls the template? (I've seen some people put in their global include, but that is very wasteful of resources...) |
"hook postbit_create"
$blah = $db->query_read("SELECT * FROM ") "filter results" $blah = '<a href="disney.com">' . $filtered . '</a>'; in the postbit template put $blah where you want the text to appear put the query in a hook and make the variable there... not sure this was the question |
Quote:
What do you mean by "filter results"? |
well
Code:
$result = $db->query_read("SELECT * FROM " . TABLE_PREFIX . "user"); if you want just the first row, you could use Code:
$user = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "user"); |
Thanks, got it.
|
All times are GMT. The time now is 12:11 AM. |
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:
|