my query result is this
#######################
TestName | Count | Result
PHP 1 Passed
PHP 1 Failed
Test Your IQ? 2 Passed
Test Your IQ? 5 Failed
######################
i want to manipulate the result so that i can show it like this
############################
TestName Count PassCount FailCount
PHP 2 1 1
Test Your IQ? 7 2 5
#############################
How can i do this
Pls Help
Thanx in Advance
[/b][/php_man]
Query Manipulation after getting a result set
Moderator: General Moderators
Here is the complete solutions
$sql="SELECT t.title, count(r.testId) as count, r.result
FROM qb_test_report AS r, qb_test AS t
WHERE r.status = 'Completed' AND t.testId = r.testId
GROUP BY r.result, t.testId ORDER BY t.title" ;
$rs = $db->Execute($sql);
if($rs->RecordCount()>0){
while($row = $rs->FetchRow()){
${$row['result']} = $row['count'];
$row = $rs->FetchRow();
${$row['result']} = $row['count'];
$total = $Passed + $Failed ;
}
Bye
$sql="SELECT t.title, count(r.testId) as count, r.result
FROM qb_test_report AS r, qb_test AS t
WHERE r.status = 'Completed' AND t.testId = r.testId
GROUP BY r.result, t.testId ORDER BY t.title" ;
$rs = $db->Execute($sql);
if($rs->RecordCount()>0){
while($row = $rs->FetchRow()){
${$row['result']} = $row['count'];
$row = $rs->FetchRow();
${$row['result']} = $row['count'];
$total = $Passed + $Failed ;
}
Bye