function viewdataChronoContact($ids, $option) { global $mainframe; $database =& JFactory::getDBO(); $fids = explode("_", $ids); $table = JRequest::getVar('table', '', 'post', 'string', 0); # get primary key $tables = array(); $tables[] = $table; $result = $database->getTableFields($tables, false); $table_fields = $result[$table]; $primary = 'cf_id'; foreach ($table_fields as $table_field => $field_data) { if ($field_data->Key == 'PRI') { $primary = $table_field; } } $database->setQuery("SELECT * FROM " . $table . " WHERE " . $primary . "=" . $fids[0]); $rows = $database->loadObjectList(); $row = $rows[0]; $tablename = $table; //echo "SELECT * FROM ".$table." WHERE ".$primary."=".$fids[0]; HTML_ChronoContact::viewdataChronoContact($row, $option, $tablename, $fids[1]); }