Dear Team,
I am having two inputs (From month & To mont). I want to sum the column data basedon the month selection. My sql table looks like
my code is
$dealerid = $_POST["dealerid"];
$FromMonth=$_POST["fromMonth"];
$ToMonth = $_POST["toMonth"];
$ES_Model = $_POST["ES_Model"];
$countMonth = //here the month sould update like Jan+Feb+Mar... as per the selection
if($FromMonth == "" && $ToMonth == ""){
$Month_Condition = "";
$Sum = "sum(total)";
I know it's your database table. But you have designed it like a spreadsheet, which is completely the wrong approach.
Data stored in a database needs to be correctly normalized (There's a link in my sig to a tutorial). For example,
Dealername should be stored once in a dealer table with its id, not repeated in every row in this table. Only ids should be stored in multiple tables.
Repeating columns likeyour months should be in separate rows.
If, as I am guessing, a model