I'm working on a Drupal 5.x site. I have a "server" custom node type with its own set of custom fields and a working content template.
However, I have another table in my database that I call "connections". It's essentially a connection log for these "server" node types that is generated by an external application (a connection logger application). The nid and vid of the server are stored in the table along with some connection info.
Each "server" can have 0 or more "connection" entries -- one is generated for each server connection in the connection logger. I would like to display a list of these connection entries for each server on that server's page.
It's easy enough to get the entries for each individual server ( SELECT * FROM 'connections' WHERE vid = {insert VID here} ), but how would I go about doing that?
Can I run a query from within a content template?
Is there some other custom code I would need to write somewhere to make the data available to use in my content template?
Disclaimer: I only have a moderate understanding of the Drupal engine and I only have a moderate understanding of PHP -- enough to get things done, but not enough to already know the answer to this.
Comments
Query From A Content Template Works
It seems that it really is that easy. This code will query my connections table and print a list of the connection results (or print nothing if no results are available):