Jump to content

MySQL SUM Query


DanielWhite

Recommended Posts

Hey,

 

Does anyone know why this won't work:

 

mysql_query("SELECT SUM(InkCosts) FROM Stats WHERE Month='$MONTH' AND Year='$YEAR'"); 

 

The table name is correct,

The $MONTH variable is working.

The $YEAR variable is working.

The InkCosts is the right field name.

 

The code below;

$INK = mysql_query("SELECT SUM(InkCosts) FROM Stats WHERE Month='$MONTH' AND Year='$YEAR'"); 
echo $INK;

Prints this:

Resource id #4

 

 

Thank you,

Daniel White.

Link to comment
https://forums.phpfreaks.com/topic/111759-mysql-sum-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.