BosstonKUKU
-
Posts
4 -
Joined
-
Last visited
Posts posted by BosstonKUKU
-
-
Sorry sir for not being more specific. What i am building now is a dynamic report in php using PDO format and i am using MySQL Multi Column cross Tabulation AKA pivot table. But the problem is how i can apply this query in PHP PDO format.
This is my current progress.
try{ $handler = new PDO('mysql:host=localhost;dbname=DatabaseName','Username','Password'); $handler ->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); }catch(PDOException $e){ die($e->getMessage()); } $query = $handler->query (
"Select TransactionType,TransactionCount From dummy_transaction"); while($row = $query->fetch()){ echo $row['TransactionType'], echo $row['TransactionCount'], '<br>'; }
But i don't have any idea on how to deal with this query and apply in PHP PDO format. Something like i am dealing in multi-query. Any advice sir well appreciated. And thank you for the reply.
-
I have existing query which successfully output a dynamic table using pivot. But the problem is i have no idea how to apply this in PDO format in php. Any help please.SELECT GROUP_CONCAT(DISTINCT CONCAT('SUM(IF(DateTransact = ''',DateTransact,''', TransactionCount, NULL))' ))INTO @sqlFROM dummy_transaction;SET @sql = CONCAT('SELECT TransactionType, ', @sql, ' FROM dummy_transaction GROUP BY TransactionType ');PREPARE stmt FROM @sql;EXECUTE stmt;
Using PDO format in php
in PHP Coding Help
Posted
Sorry for miss arrangement i can't edit.