function scoreboard_menu() {
$items = array();
$items['scoreboard'] = array(
'title' => t('My Scoreboard'),
'description' => t('Scoreboard'),
'page callback' => 'scoreboard_main_page',
'access arguments' => array('access content'),
'type' => MENU_CALLBACK,
);
return $items;
}
function scoreboard_main_page() {
$output = '';
$table = array();
$header = array(
);
$date = date('Y-m-d');
db_set_active('customdb');
$results = db_query('SELECT * FROM WHERE filter LIKE "%s%%" GROUP BY groupfield ORDER BY orderfield DESC', $date);
db_set_active();
while ($line = db_fetch_object($results)) {
$table[] = $line;
}
$output .= theme('table', $header, $table, array('class' => 'scoreboard-table'));
return $output;
}
Just make sure you have your database settings in your settings.php. Seems to work for me for simple tasks
On Wed, Jul 22, 2009 at 1:11 PM, Rahul Nabar<
rpnabar@gmail.com> wrote:
> On Wed, Jul 22, 2009 at 2:21 PM, sivaji j.g<
sivaji2009@gmail.com> wrote:
>> On Thu, Jul 23, 2009 at 12:45 AM, Rahul Nabar <
rpnabar@gmail.com> wrote:
>>>
>>> We have a mysql database storing a bunch of scientific data and I have
>>> a cron script querying the database and making html tables of key
>>> data. Is there a way how this content (the resulting html pages) can
>>> be integrated and managed via drupal? Especially the link structure
>>> etc.?
>>
>> It is very difficult to answer with this minimal information.
>
> Sorry if I was terse. I'll try to do better:
>
> I have data in a mysql database. In order to present this I (or rather
> a cron script) usually run on the command line something like:
>
> echo 'SELECT * FROM footable' | mysql -h
foo.bar.edu -u foouser -p
> --html bar_db > temp.html
>
> Then a webpage.php file adds some more headers, css styling etc. and
> presents this page. Something like:
>
>
http://files.getdropbox.com/u/118481/mqsql_html.jpg
>
>
> Unfortunately there are several such "autogenerated" pages and it is
> hard to keep track of up-to-date menus, links etc. I was wondering if
> this was facilitated by Drupal. Maybe even if Drupal was the right
> tool for this job at all.
>
> --
> Rahul
> --
> [ Drupal support list |
http://lists.drupal.org/ ]
>