• Some users have recently had their accounts hijacked. It seems that the now defunct EVGA forums might have compromised your password there and seems many are using the same PW here. We would suggest you UPDATE YOUR PASSWORD and TURN ON 2FA for your account here to further secure it. None of the compromised accounts had 2FA turned on.
    Once you have enabled 2FA, your account will be updated soon to show a badge, letting other members know that you use 2FA to protect your account. This should be beneficial for everyone that uses FSFT.

Php Mysqli SUM not working?

boycee

Gawd
Joined
Oct 2, 2001
Messages
735
I think I'm going mad, but query is not returning any values, only nulls.

The query is fine and works fine in phpmyadmin, so the implementation must be off? Or it's a bug?

Any takers?

Code:
SELECT SUM( colCount ) AS re
FROM (
SELECT COUNT( colPage ) AS colCount
FROM browserData b
GROUP BY colPage
ORDER BY colCount DESC 
LIMIT 0 , 2
)table1

Code:
		private function selectQuery($query)
		{
			$statement = $this->_connection->prepare($query);
			if($statement == null)
			{
			  die("Bad SQL Statement");
			}
			$statement->execute();
            $meta = $statement->result_metadata(); 
            while ($field = $meta->fetch_field()) 
            { 
                $params[] = &$row[$field->name];
            }             
            
            call_user_func_array(array($statement, 'bind_result'), $params); 
            
            while ($statement->fetch()) 
            { 
                echo '<br/><br/><br/>';
                foreach($row as $key => $val) 
                { 
                    echo 'Field:' . $key . '<br/>';
                    $c[$key] = $val; 
                } 
                $result[] = $c; 
            }             
            
            $statement->close(); 
            
            return $result;
		}
 
Back
Top