orise Posted March 22, 2012 Share Posted March 22, 2012 hello, please can anyone help me out with the codes I want to pivot it Item ID Year Type Item Value 68 2012 Assets Cash 343.556 69 2012 Assets Treasury bills 343.556 70 2012 Assets Cash and Short Term funds 687.111 71 2012 Assets Collateral by Third Parties 343.556 72 2012 Assets Operating account with Central Banks 343.556 73 2012 Assets Cash reserves with Central Banks 343.556 74 2012 Assets Overnight placements 343.556 75 2012 Assets Eskrow with Central Banks 343.556 76 2012 Assets Banks within Nigeria 343.556 77 2012 Assets Banks outside Nigeria 343.556 78 2012 Assets Inter-bank placements 343.556 79 2012 Assets Provision for doubtful balances 343.556 80 2012 Assets Federal Government of Nigeria bonds 343.556 81 2012 Assets Due from banks 2748.44 82 2012 Assets Listed equity securities 343.556 83 2012 Assets Other liquid assets 343.556 84 2012 Assets Dealing securities 687.111 85 2012 Assets Overdrafts 343.556 86 2012 Assets Term loans 0 87 2012 Assets Mortgage loans 0 88 2012 Assets Commercial paper 0 89 2012 Assets Originated by the bank 343.556 90 2012 Assets Other 0 91 2012 Assets Loan loss provision 0 92 2012 Assets Loans and advances 0 93 2012 Assets Interest in suspence 0 94 2012 Assets Advances under finance lease 0 95 2012 Assets Other assets 0 96 2012 Assets Investment securities 0 97 2012 Assets Investment in subsidiary 0 98 2012 Assets Insurance assets 0 99 2012 Assets Other facilities 0 100 2012 Assets Goodwill 0 101 2012 Assets Defferes tax assets 0 102 2012 Assets Property and equipment 0 103 2012 Assets total Assets 4809.78 to Item 2012 2011 2010 2009 2008 2007 2006 ... Cash 0 0 0 0 0 0 0 Treasury bills 0 0 0 0 0 0 0 . . . I need to do pivot it and display using PHP as all possible ways to do the using Mysql was unsuccessful Quote Link to comment https://forums.phpfreaks.com/topic/259502-pivot-table-using-php-codes/ Share on other sites More sharing options...
Muddy_Funster Posted March 22, 2012 Share Posted March 22, 2012 have you googled "php mysql crosstab table scripts"? because unless you have some code to show us it's very likley going to get you further than posting here will. This forum is for support for people who have problems with their own existing code. The other thing you could do is post in the freelance section and see how much someone will charge to write it for you. Quote Link to comment https://forums.phpfreaks.com/topic/259502-pivot-table-using-php-codes/#findComment-1330234 Share on other sites More sharing options...
orise Posted March 22, 2012 Author Share Posted March 22, 2012 My bad, here is the code and the the values below CREATE TABLE IF NOT EXISTS `balancesheetitem` ( `item_id` int(30) NOT NULL AUTO_INCREMENT, `balance_id` int(11) DEFAULT NULL, `year` year(4) NOT NULL, `state_type` varchar(11) NOT NULL, `item` varchar(40) NOT NULL, `value` float DEFAULT NULL, `company` varchar(30) NOT NULL, PRIMARY KEY (`item_id`), UNIQUE KEY `balance_id` (`balance_id`) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=202 ; -- -- Dumping data for table `balancesheetitem` -- INSERT INTO `balancesheetitem` (`item_id`, `balance_id`, `year`, `state_type`, `item`, `value`, `company`) VALUES (31, NULL, 2012, 'Assets', 'Insurance assets', 0, 'Jubilee Cooperative Limited'), (32, NULL, 2012, 'Assets', 'Other facilities', 0, 'Jubilee Cooperative Limited'), (33, NULL, 2012, 'Assets', 'Goodwill', 0, 'Jubilee Cooperative Limited'), (34, NULL, 2012, 'Assets', 'Defferes tax assets', 0, 'Jubilee Cooperative Limited'), (35, NULL, 2012, 'Assets', 'Property and equipment', 0, 'Jubilee Cooperative Limited'), (36, NULL, 2012, 'Assets', 'total Assets', 0, 'Jubilee Cooperative Limited'), (37, NULL, 2012, 'Liabilities', 'Current accounts', 0, 'Jubilee Cooperative Limited'), (38, NULL, 2012, 'Liabilities', 'Savings accounts', 0, 'Jubilee Cooperative Limited'), (39, NULL, 2012, 'Liabilities', 'High Net Yield Investment', 0, 'Jubilee Cooperative Limited'), (40, NULL, 2012, 'Liabilities', 'Term and other deposits', 0, 'Jubilee Cooperative Limited'), (41, NULL, 2012, 'Liabilities', 'Short-term borrowing', 0, 'Jubilee Cooperative Limited'), (42, NULL, 2012, 'Liabilities', 'Tax payable', 0, 'Jubilee Cooperative Limited'), (43, NULL, 2012, 'Liabilities', 'Other liabilities (interest-bearing)', 0, 'Jubilee Cooperative Limited'), (44, NULL, 2012, 'Liabilities', 'Other liabilities (non-interest bearing)', 0, 'Jubilee Cooperative Limited'), (45, NULL, 2012, 'Liabilities', 'Deffered tax', 0, 'Jubilee Cooperative Limited'), (46, NULL, 2012, 'Liabilities', 'Long-term borrowing', 0, 'Jubilee Cooperative Limited'), (47, NULL, 2012, 'Liabilities', 'Due to other banks', 0, 'Jubilee Cooperative Limited'), (48, NULL, 2012, 'Liabilities', 'Retirement benefit obligations', 0, 'Jubilee Cooperative Limited'), (49, NULL, 2012, 'Liabilities', 'Insurance liabilities', 0, 'Jubilee Cooperative Limited'), (50, NULL, 2012, 'Liabilities', 'Subordinated debt', 0, 'Jubilee Cooperative Limited'), (51, NULL, 2012, 'Liabilities', 'Long and Short Term Liability', 0, 'Jubilee Cooperative Limited'), (52, NULL, 2012, 'Liabilities', 'Share capital', 0, 'Jubilee Cooperative Limited'), (53, NULL, 2012, 'Liabilities', 'Share premium', 0, 'Jubilee Cooperative Limited'), (54, NULL, 2012, 'Liabilities', 'Retained earnings', 0, 'Jubilee Cooperative Limited'), (55, NULL, 2012, 'Liabilities', 'Other reserves', 0, 'Jubilee Cooperative Limited'), (56, NULL, 2012, 'Liabilities', 'Shareholders Funds', 0, 'Jubilee Cooperative Limited'), (57, NULL, 2012, 'Liabilities', 'Minority interest', 0, 'Jubilee Cooperative Limited'), (58, NULL, 2012, 'Liabilities', 'Supplementary capital', 0, 'Jubilee Cooperative Limited'), (59, NULL, 2012, 'Liabilities', 'Total Liabilities and shareholders funds', 0, 'Jubilee Cooperative Limited'), (60, NULL, 2012, 'others', 'Acceptances and guarantees', 0, 'Jubilee Cooperative Limited'), (61, NULL, 2012, 'others', 'Non-performing loans', 0, 'Jubilee Cooperative Limited'), (62, NULL, 2012, 'others', 'Non-performing leases', 0, 'Jubilee Cooperative Limited'), (63, NULL, 2012, 'others', 'Tier 1 Capital', 0, 'Jubilee Cooperative Limited'), (64, NULL, 2012, 'others', 'Number of employees', 0, 'Jubilee Cooperative Limited'), (65, NULL, 2012, 'others', 'Number of branches', 0, 'Jubilee Cooperative Limited'), (66, NULL, 2012, 'others', 'Number of mini-branches', 0, 'Jubilee Cooperative Limited'), (67, NULL, 2012, 'others', 'Risk weighted assets', 0, 'Jubilee Cooperative Limited'), (68, NULL, 2012, 'Assets', 'Cash', 343.556, 'Themis Risk Advisory'), (69, NULL, 2012, 'Assets', 'Treasury bills', 343.556, 'Themis Risk Advisory'), (70, NULL, 2012, 'Assets', 'Cash and Short Term funds', 687.111, 'Themis Risk Advisory'), (71, NULL, 2012, 'Assets', 'Collateral by Third Parties', 343.556, 'Themis Risk Advisory'), (72, NULL, 2012, 'Assets', 'Operating account with Central Banks', 343.556, 'Themis Risk Advisory'), (73, NULL, 2012, 'Assets', 'Cash reserves with Central Banks', 343.556, 'Themis Risk Advisory'), (74, NULL, 2012, 'Assets', 'Overnight placements', 343.556, 'Themis Risk Advisory'), (75, NULL, 2012, 'Assets', 'Eskrow with Central Banks', 343.556, 'Themis Risk Advisory'), (76, NULL, 2012, 'Assets', 'Banks within Nigeria', 343.556, 'Themis Risk Advisory'), (77, NULL, 2012, 'Assets', 'Banks outside Nigeria', 343.556, 'Themis Risk Advisory'), (78, NULL, 2012, 'Assets', 'Inter-bank placements', 343.556, 'Themis Risk Advisory'), (79, NULL, 2012, 'Assets', 'Provision for doubtful balances', 343.556, 'Themis Risk Advisory'), (80, NULL, 2012, 'Assets', 'Federal Government of Nigeria bonds', 343.556, 'Themis Risk Advisory'), (81, NULL, 2012, 'Assets', 'Due from banks', 2748.44, 'Themis Risk Advisory'), (82, NULL, 2012, 'Assets', 'Listed equity securities', 343.556, 'Themis Risk Advisory'), (83, NULL, 2012, 'Assets', 'Other liquid assets', 343.556, 'Themis Risk Advisory'), (84, NULL, 2012, 'Assets', 'Dealing securities', 687.111, 'Themis Risk Advisory'), (85, NULL, 2012, 'Assets', 'Overdrafts', 343.556, 'Themis Risk Advisory'), (86, NULL, 2012, 'Assets', 'Term loans', 0, 'Themis Risk Advisory'), (87, NULL, 2012, 'Assets', 'Mortgage loans', 0, 'Themis Risk Advisory'), (88, NULL, 2012, 'Assets', 'Commercial paper', 0, 'Themis Risk Advisory'), (89, NULL, 2012, 'Assets', 'Originated by the bank', 343.556, 'Themis Risk Advisory'), (90, NULL, 2012, 'Assets', 'Other', 0, 'Themis Risk Advisory'), (91, NULL, 2012, 'Assets', 'Loan loss provision', 0, 'Themis Risk Advisory'), (92, NULL, 2012, 'Assets', 'Loans and advances', 0, 'Themis Risk Advisory'), (93, NULL, 2012, 'Assets', 'Interest in suspence', 0, 'Themis Risk Advisory'), (94, NULL, 2012, 'Assets', 'Advances under finance lease', 0, 'Themis Risk Advisory'), (95, NULL, 2012, 'Assets', 'Other assets', 0, 'Themis Risk Advisory'), (96, NULL, 2012, 'Assets', 'Investment securities', 0, 'Themis Risk Advisory'), (97, NULL, 2012, 'Assets', 'Investment in subsidiary', 0, 'Themis Risk Advisory'), (98, NULL, 2012, 'Assets', 'Insurance assets', 0, 'Themis Risk Advisory'), (99, NULL, 2012, 'Assets', 'Other facilities', 0, 'Themis Risk Advisory'), (100, NULL, 2012, 'Assets', 'Goodwill', 0, 'Themis Risk Advisory'), (101, NULL, 2012, 'Assets', 'Defferes tax assets', 0, 'Themis Risk Advisory'), (102, NULL, 2012, 'Assets', 'Property and equipment', 0, 'Themis Risk Advisory'), (103, NULL, 2012, 'Assets', 'total Assets', 4809.78, 'Themis Risk Advisory'), (104, NULL, 2012, 'Liabilities', 'Current accounts', 0, 'Themis Risk Advisory'), (105, NULL, 2012, 'Liabilities', 'Savings accounts', 0, 'Themis Risk Advisory'), (106, NULL, 2012, 'Liabilities', 'High Net Yield Investment', 0, 'Themis Risk Advisory'), (107, NULL, 2012, 'Liabilities', 'Term and other deposits', 0, 'Themis Risk Advisory'), (108, NULL, 2012, 'Liabilities', 'Short-term borrowing', 0, 'Themis Risk Advisory'), (109, NULL, 2012, 'Liabilities', 'Tax payable', 0, 'Themis Risk Advisory'), (110, NULL, 2012, 'Liabilities', 'Other liabilities (interest-bearing)', 0, 'Themis Risk Advisory'), (111, NULL, 2012, 'Liabilities', 'Other liabilities (non-interest bearing)', 0, 'Themis Risk Advisory'), (112, NULL, 2012, 'Liabilities', 'Deffered tax', 0, 'Themis Risk Advisory'), (113, NULL, 2012, 'Liabilities', 'Long-term borrowing', 0, 'Themis Risk Advisory'), (114, NULL, 2012, 'Liabilities', 'Due to other banks', 0, 'Themis Risk Advisory'), (115, NULL, 2012, 'Liabilities', 'Retirement benefit obligations', 0, 'Themis Risk Advisory'), (116, NULL, 2012, 'Liabilities', 'Insurance liabilities', 0, 'Themis Risk Advisory'), (117, NULL, 2012, 'Liabilities', 'Subordinated debt', 0, 'Themis Risk Advisory'), (118, NULL, 2012, 'Liabilities', 'Long and Short Term Liability', 0, 'Themis Risk Advisory'), (119, NULL, 2012, 'Liabilities', 'Share capital', 0, 'Themis Risk Advisory'), (120, NULL, 2012, 'Liabilities', 'Share premium', 0, 'Themis Risk Advisory'), (121, NULL, 2012, 'Liabilities', 'Retained earnings', 0, 'Themis Risk Advisory'), (122, NULL, 2012, 'Liabilities', 'Other reserves', 0, 'Themis Risk Advisory'), (123, NULL, 2012, 'Liabilities', 'Shareholders Funds', 0, 'Themis Risk Advisory'), (124, NULL, 2012, 'Liabilities', 'Minority interest', 0, 'Themis Risk Advisory'), (125, NULL, 2012, 'Liabilities', 'Supplementary capital', 0, 'Themis Risk Advisory'), (126, NULL, 2012, 'Liabilities', 'Total Liabilities and shareholders funds', 0, 'Themis Risk Advisory'), (127, NULL, 2012, 'others', 'Acceptances and guarantees', 0, 'Themis Risk Advisory'), (128, NULL, 2012, 'others', 'Non-performing loans', 0, 'Themis Risk Advisory'), (129, NULL, 2012, 'others', 'Non-performing leases', 0, 'Themis Risk Advisory'), (130, NULL, 2012, 'others', 'Tier 1 Capital', 0, 'Themis Risk Advisory'), (131, NULL, 2012, 'others', 'Number of employees', 0, 'Themis Risk Advisory'), (132, NULL, 2012, 'others', 'Number of branches', 0, 'Themis Risk Advisory'), (133, NULL, 2012, 'others', 'Number of mini-branches', 0, 'Themis Risk Advisory'), (134, NULL, 2012, 'others', 'Risk weighted assets', 0, 'Themis Risk Advisory'), (135, NULL, 2012, 'Assets', 'Cash', 343.556, 'Themis Risk Advisory'), (136, NULL, 2012, 'Assets', 'Treasury bills', 343.556, 'Themis Risk Advisory'), (137, NULL, 2012, 'Assets', 'Cash and Short Term funds', 687.111, 'Themis Risk Advisory'), (138, NULL, 2012, 'Assets', 'Collateral by Third Parties', 343.556, 'Themis Risk Advisory'), (139, NULL, 2012, 'Assets', 'Operating account with Central Banks', 343.556, 'Themis Risk Advisory'), (140, NULL, 2012, 'Assets', 'Cash reserves with Central Banks', 343.556, 'Themis Risk Advisory'), (141, NULL, 2012, 'Assets', 'Overnight placements', 343.556, 'Themis Risk Advisory'), (142, NULL, 2012, 'Assets', 'Eskrow with Central Banks', 343.556, 'Themis Risk Advisory'), (143, NULL, 2012, 'Assets', 'Banks within Nigeria', 343.556, 'Themis Risk Advisory'), (144, NULL, 2012, 'Assets', 'Banks outside Nigeria', 343.556, 'Themis Risk Advisory'), (145, NULL, 2012, 'Assets', 'Inter-bank placements', 343.556, 'Themis Risk Advisory'), (146, NULL, 2012, 'Assets', 'Provision for doubtful balances', 343.556, 'Themis Risk Advisory'), (147, NULL, 2012, 'Assets', 'Federal Government of Nigeria bonds', 343.556, 'Themis Risk Advisory'), (148, NULL, 2012, 'Assets', 'Due from banks', 2748.44, 'Themis Risk Advisory'), (149, NULL, 2012, 'Assets', 'Listed equity securities', 343.556, 'Themis Risk Advisory'), (150, NULL, 2012, 'Assets', 'Other liquid assets', 343.556, 'Themis Risk Advisory'), (151, NULL, 2012, 'Assets', 'Dealing securities', 687.111, 'Themis Risk Advisory'), (152, NULL, 2012, 'Assets', 'Overdrafts', 343.556, 'Themis Risk Advisory'), (153, NULL, 2012, 'Assets', 'Term loans', 0, 'Themis Risk Advisory'), (154, NULL, 2012, 'Assets', 'Mortgage loans', 0, 'Themis Risk Advisory'), (155, NULL, 2012, 'Assets', 'Commercial paper', 0, 'Themis Risk Advisory'), (156, NULL, 2012, 'Assets', 'Originated by the bank', 343.556, 'Themis Risk Advisory'), (157, NULL, 2012, 'Assets', 'Other', 0, 'Themis Risk Advisory'), (158, NULL, 2012, 'Assets', 'Loan loss provision', 0, 'Themis Risk Advisory'), (159, NULL, 2012, 'Assets', 'Loans and advances', 0, 'Themis Risk Advisory'), (160, NULL, 2012, 'Assets', 'Interest in suspence', 0, 'Themis Risk Advisory'), (161, NULL, 2012, 'Assets', 'Advances under finance lease', 0, 'Themis Risk Advisory'), (162, NULL, 2012, 'Assets', 'Other assets', 0, 'Themis Risk Advisory'), (163, NULL, 2012, 'Assets', 'Investment securities', 0, 'Themis Risk Advisory'), (164, NULL, 2012, 'Assets', 'Investment in subsidiary', 0, 'Themis Risk Advisory'), (165, NULL, 2012, 'Assets', 'Insurance assets', 0, 'Themis Risk Advisory'), (166, NULL, 2012, 'Assets', 'Other facilities', 0, 'Themis Risk Advisory'), (167, NULL, 2012, 'Assets', 'Goodwill', 0, 'Themis Risk Advisory'), (168, NULL, 2012, 'Assets', 'Defferes tax assets', 0, 'Themis Risk Advisory'), (169, NULL, 2012, 'Assets', 'Property and equipment', 0, 'Themis Risk Advisory'), (170, NULL, 2012, 'Assets', 'total Assets', 4809.78, 'Themis Risk Advisory'), (171, NULL, 2012, 'Liabilities', 'Current accounts', 0, 'Themis Risk Advisory'), (172, NULL, 2012, 'Liabilities', 'Savings accounts', 0, 'Themis Risk Advisory'), (173, NULL, 2012, 'Liabilities', 'High Net Yield Investment', 0, 'Themis Risk Advisory'), (174, NULL, 2012, 'Liabilities', 'Term and other deposits', 0, 'Themis Risk Advisory'), (175, NULL, 2012, 'Liabilities', 'Short-term borrowing', 0, 'Themis Risk Advisory'), (176, NULL, 2012, 'Liabilities', 'Tax payable', 0, 'Themis Risk Advisory'), (177, NULL, 2012, 'Liabilities', 'Other liabilities (interest-bearing)', 0, 'Themis Risk Advisory'), (178, NULL, 2012, 'Liabilities', 'Other liabilities (non-interest bearing)', 0, 'Themis Risk Advisory'), (179, NULL, 2012, 'Liabilities', 'Deffered tax', 0, 'Themis Risk Advisory'), (180, NULL, 2012, 'Liabilities', 'Long-term borrowing', 0, 'Themis Risk Advisory'), (181, NULL, 2012, 'Liabilities', 'Due to other banks', 0, 'Themis Risk Advisory'), (182, NULL, 2012, 'Liabilities', 'Retirement benefit obligations', 0, 'Themis Risk Advisory'), (183, NULL, 2012, 'Liabilities', 'Insurance liabilities', 0, 'Themis Risk Advisory'), (184, NULL, 2012, 'Liabilities', 'Subordinated debt', 0, 'Themis Risk Advisory'), (185, NULL, 2012, 'Liabilities', 'Long and Short Term Liability', 0, 'Themis Risk Advisory'), (186, NULL, 2012, 'Liabilities', 'Share capital', 0, 'Themis Risk Advisory'), (187, NULL, 2012, 'Liabilities', 'Share premium', 0, 'Themis Risk Advisory'), (188, NULL, 2012, 'Liabilities', 'Retained earnings', 0, 'Themis Risk Advisory'), (189, NULL, 2012, 'Liabilities', 'Other reserves', 0, 'Themis Risk Advisory'), (190, NULL, 2012, 'Liabilities', 'Shareholders Funds', 0, 'Themis Risk Advisory'), (191, NULL, 2012, 'Liabilities', 'Minority interest', 0, 'Themis Risk Advisory'), (192, NULL, 2012, 'Liabilities', 'Supplementary capital', 0, 'Themis Risk Advisory'), (193, NULL, 2012, 'Liabilities', 'Total Liabilities and shareholders funds', 0, 'Themis Risk Advisory'), (194, NULL, 2012, 'others', 'Acceptances and guarantees', 0, 'Themis Risk Advisory'), (195, NULL, 2012, 'others', 'Non-performing loans', 0, 'Themis Risk Advisory'), (196, NULL, 2012, 'others', 'Non-performing leases', 0, 'Themis Risk Advisory'), (197, NULL, 2012, 'others', 'Tier 1 Capital', 0, 'Themis Risk Advisory'), (198, NULL, 2012, 'others', 'Number of employees', 0, 'Themis Risk Advisory'), (199, NULL, 2012, 'others', 'Number of branches', 0, 'Themis Risk Advisory'), (200, NULL, 2012, 'others', 'Number of mini-branches', 0, 'Themis Risk Advisory'), (201, NULL, 2012, 'others', 'Risk weighted assets', 0, 'Themis Risk Advisory'); Quote Link to comment https://forums.phpfreaks.com/topic/259502-pivot-table-using-php-codes/#findComment-1330235 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.