Hello
I have two different database from which one is of drupal and another is custom application. Custom application is complicated so i can not make module of that.
Now with help of this http://drupal.org/node/18429 i have connected 2 different database at a time.
What i want to know is how can i display those data in one page / my account page ?
here is my basic code which i have written. If any error are there than please help me out. I am stuck here.
<?php
function modulename_menu() {
$items = array();
$items['admin/settings/modulename'] = array(
'title' => ' module settings',
'description' => 'modulename setting',
'page callback' => 'drupal_get_form',
'page arguments' => array('modulename_admin'),
'access arguments' => array('access modulename pages'),
'type' => MENU_NORMAL_ITEM,
);
$items['modulename'] = array(
'title' => t('modulename list down data from different database in one page or home page after login'),
'description' => t('View reports.'),
'page callback' => 'automation_view',
'access callback' => 'user_access',
'access arguments' => array('access modulename'),
'type' => MENU_NORMAL_ITEM
);
return $items;
}
function modulename_view($node, $teaser = FALSE, $page = FALSE)
{
global $user;
db_set_active('another_db');
$sql = 'SELECT * FROM {another_table} WHERE user_id = '.$user->uid;
$result = db_query($sql);
$i =0;
while ($product = db_fetch_object($result))
{
$prod_name[$i] = $product->prod_name;
$i++;
}
// at this point i have tried different theme option but might be i am using wrong syntax or method it is not working.
db_set_active('default');
}
?>
I hope my question is clear in this post. If you have any query regarding this post than let me know i will explain it again.
Thank you.
Tejas Mehta
Comments
Comment #1
tejaspmehta commentedi have found theme() function which can help but its not displaying data in to theme format. I have copied my recent code as well as screen shot also.
If anyone can help me to display this data in proper format than i will be thankfull to you.
Thank you
Tejas Mehta
Comment #2
tejaspmehta commentedComment #3
drgoettel commentedCould you post the answer to your question so everybody can learn how to solve it??
Thankyou!
Comment #4
priyanka.salunke commentedComment #5
priyanka.salunke commented