I am trying to get the sum hours for each month from a given user and having problems with the code. Need help.
what I have so far:
$sql = “SELECT sum(hours) AS total_Hours FROM flights WHERE month = 3
and username=’$myname'”;
This isn’t even working, But what i really need is total hours from user for each month.
possible?
Here is the query asking sum for each month:
Also you should know that your
$mynamevariable must to be escaped with mysql_real_escape_string before passing in a query.@Robbie is telling right about escaping
month. It seems to be the only problem of your query.