...

View Full Version : mysql query Question



getbestproduct
08-25-2010, 12:56 PM
$Test = ("SELECT Test, SUM(IF(Test = 'Til', 1,0)) AS `T`, SUM(IF(Test = 'Sil', 1,0)) AS `S` FROM `Show` GROUP BY `Test`");

$get = mysqli_query($mysqli, $Test)or die("Error: ".mysqli_error($mysqli));

$gg = mysqli_fetch_array($get);

echo $gg['T'];
echo $gg['S'];

When I try something like this, I can get the correct result for the first sum, but after that, it reverts to 0. I was wondering how I could get this to work for both. Thanks again.

Fumigator
08-25-2010, 06:10 PM
Why are you copy pasting someone else's post?

http://codingforums.com/showthread.php?t=202988

jdswebservice
08-28-2010, 03:23 AM
EPIC FAIL!!!!!!!!!

http://www.samizdata.net/blog/~pdeh/epicFAIL.jpg

abduraooft
08-28-2010, 12:31 PM
Why are you copy pasting someone else's post?

http://codingforums.com/showthread.php?t=202988Isn't this called as Déjà vu :rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum