I'm trying to query my DB, and return those values as variables, then print those variables on my custom module's custom template and I can't get it to work.
If I put this into my theme layer it works fine.
$name=db_result(db_query('SELECT name FROM {users} WHERE id = %d', 2));
print $name;
I'd rather keep my queries in the .module file and only have to print the variable on my template. So far I haven't been successful.
Also, since I'm planning on having many variables used in many places (like display tables, or as values in calculations) I'd rather be able to print variables where I need them, and not tie them to an $output
, or $content
variable.
I referenced this post but I couldn't get the example to work.
I'm really new at this, my experience so far as only to take form info and save it to the DB, not bringing it back. so I'd appreciate any help.