Hello friends, am having problem with my SUM function. I tried summing up some figures in a column but is not returning the total of the figures. this is my syntax <?php include("config.php"); $column='amount'; $table='transactions' $creditbal=mysql_query("SELECT SUM($column), FROM $table WHERE status='P'"); $rows=mysql_fetch_array($creditbal); echo $creditbal; ?> but is not echoing any out any, what can i do. Regards, adsegzy
try this: <?php include("config.php"); $column='amount'; $table='transactions'; $creditbal=mysql_query("SELECT SUM($column), FROM $table WHERE status='P'"); $rows=mysql_fetch_array($creditbal); echo $rows; ?> PHP:
When your developing a script, you should have it setup to show you errors. Place or die (mysql_error()) at the end of all of your functions that way if there is a problem with the SQL code it will let you know, rather then just return nothing. Glen