Home about IT Motivation Course Sales Project About Me

Thursday, June 18, 2009

PHP: create pivot table use ADODB

<?

//includekan class addob

include('adodb/adodb.inc.php');
include "adodb/pivottable.inc.php";
$db = ADONewConnection("mysql");
$db->Connect('localhost','id','password','dbname') or die("COULD NOT SELECT DATABASE.<br>");

$sql = PivotTableSQL(
$db, # adodb connection
'berita b, kategori k', # tables
'pc_berita as PC_Name', # rows (multiple fields allowed)
'nama_berita', # column to pivot on
'b.nama_berita = k.nama_kategori and tgl_berita >= "2009-06-01"' # joins/where
);

$db->SetFetchMode(ADODB_FETCH_ASSOC);
//tampilin datanya (buat tabel)
$rs = $db->Execute($sql);
if ($rs) {
echo "<table border ='1'>";
echo "<tr>";
$head = $rs->fields;
foreach($head as $hcol=>$col)
echo "<th>".ucfirst($hcol)."</th>";

echo "</tr>";
while (!$rs->EOF) {
$row = $rs->fields;
echo "<tr>";
$x =0;
foreach($row as $head=>$col)
{

echo "<td>$col</td>";
$x++;

}
echo "</tr>";
$rs->MoveNext();
}
echo "</table>";
}
//tampilkan generate sql nya
//echo $sql;

?>

http://phplens.com/adodb/pivot.tables.html

Wednesday, June 10, 2009

PCMAV 2.0c and conflicker virus

if you got message “for first usage or upgrading to newer version, please run pcmav-rp.exe” when perform PCMAV-RTP.exe. Please do below step:

go to windows\system32 then rename files: RTPSvc.exe and RTPScan.dll. the please re-run again. Download location for PCMAV is http://pcmav.biz/

if you got virus conflicker, please use PCMAVExpress.exe.
before perform that, please unpluq the PC from LAN then path / upgrade to SP3 for Windows XP.

Sunday, June 07, 2009

Create value 0 for data if no value or NULL

select kategori.nama_kategori , count(berita.nama_berita) as hitung
from kategori left join berita on
kategori.nama_kategori = berita.nama_berita
and berita.tgl_berita >= '2009-06-01'
group by kategori.nama_kategori


ACT 1
Email 0
Hardware 0
Internet 0
Network 0
Others 0
Software 0
VMI 1