By jeremydr on
Hi,
I have a question about displaying data from one of the tables in DB in my web page, is it possible with drupal?
for example:
I have a DB table named Students and I would like to display in one of my pages all the
students that are registered to a course (and all their details as well).
in order to do that I need to query mysql and present result in some kinf of table.
I read something about the Table Manager module, any ideas?
thanks for the help,
Jeremy
Comments
...
TableManager manages its own tables. You, OTOH, have an independent table, with a particular structure, and possibly updated regularly by some other application.
Everything is possible when you know some PHP.
You can enter PHP code into your node (either directly, when you choose the "PHP code" input format; or indirectly, when you use, e.g., the macrotags module). Don't fret: it's easier than it sounds, and we're here to help.
The basic PHP code you use is:
Tweak this code to suit your particular 'students' table, paste it into a node, choose the "PHP code" input format (visible only when you're Admin), and hit "Submit". (Later you may want to create some macrotag tags for this code.)
(BTW, you may want to enable your contact form.
Thanks for your answer, I
Thanks for your answer, I tried it and it works.
Thanks
Your post really helps php noobs like myself.
Following up
Say, for instance, you want to put the age in paranthesis and make the name a link to (their profile). Can you elaborate on how to do that?
Very helpful - thanks!
I have used this extremely helpful post to help us track the status of particular webform submissions. My code is this: -
Like the "Following up" post from coloryan, I would love to be able to process the SQL output before adding something into the table fields. I'd like to turn the "Change#" (a number) which I get from the SQL, into a clickable URL very much like this: -
<a href="/node/3/submission/[Change#]" title="click to view">[change#]</a>Any clues would be very welcome indeed - Cheers!
subscribing
subscribing
hi i am an biginner in
hi i am an biginner in Drupal
please i have the same problem i want to display the Data, that i import als SQL in PHPMyadmin, in my drupal website
und where i should paste this i mean witch file exactly
Thank you :)
subscribing
subscribing
It does not work for me.
It does not work for me. What am I doing wrong?
Here's my code.
It says there is an error on line 7.
I am trying to call data from an SQL query table onto a page with php code enabled. This is the error message I am getting.
Fatal error: Call to undefined function db_fetch_array() in home/......../modules/php/php.module(80) : eval()'d code on line 7
I would appreciate your help.
Thanks
kbss
db_fetch_array is deprecated.
db_fetch_array is deprecated.