By crick on
I need to be able to generate a link that will open up a new window and show the contents of a table in my database. Any ideas? I was able to do what I want using the dba module but when using that module people are able to get to the page listing all the database tables. I only want them to be able to access the specific table that they are linked to.
Comments
if you want to see what the
if you want to see what the site to help better understand what i'm saying. go to www.crickster.com and look up Google's stock symbol (GOOG) then click on the "GOOG" link. you'll notice that anyone can click on the "tables" tab and view my entire database and that of course is very bad.
Displaying DB table contents
First, read "Displaying table data from DB",
http://drupal.org/node/83874
But... it seems that you don't want to show all the records in the table. So pass the parameter (e.g. the stock symbol) using the url ('node/1234?symb=GOOG') and embed it in the SQL query:
I do want to show all the
I appreciate your responce as it has set me in the right direction. One thing I need a little elaboration on is getting the table into a new window. If you look at the site and look up a symbol you will notice that now you are given two sets of rows with a different set of headers. The first row is coming from a table called stockapi. stockapi has only one row for each different symbol, which contains the latest quote data.
The second is a set of rows that you see contains old stock data or "history" and is retrieved from a table called stockapi_$symbol (where if $symbol = GOOG; the db table would be stockapi_GOOG.
here is the code i'm currently using to generate that 2nd set of rows:
Instead of having the 2nd set of rows displayed beneath the 1st row, I'd like to click on the "Symbol" in the first row and have a new window open up containing the 2nd set of rows. Also, I need to be able to break them up into multiple pages so that it doesn't display everything on one page.
child rows
When I hover with my mouse over GOOG I see that it points me to '/stock/?symbol=GOOG'.
You should change such links to: '/stock/history/GOOG'.
Then, in your module (let's call it 'stock'), add the following callback:
It's hard for me to be more specific because I don't see the code. I don't know how it's organized, I don't know your drupal/coding abilities.
That's trivial. Let's first tackle the first problem.
I really appreciate your
I really appreciate your help on this. Below is the entire module.
I started with the contributed stockapi.module and stock.module and have modified them. I have very little programming experience so I truely do appreciate you willingness to help. This is stock.module