Hi,

I am new in PHP world and know some basics. I have a database where date wise entries to be made by users. I would like to get results in month wise total. e.g. I have these columns in the database: fleet_no, fueling_date, quantity, price. Now I want to see the fuel price for each month in a table shape. Can anybody help me with writing a code to get desired results like. total consumption in Jan, Feb, Mar...

Thanks,

Asad

You could do something simple to help understand the needs sql statement (SHOW CREATE TABLE ) and the table . And give an example of the usage you need (if I am that and I request that I should get that).

That is more of MySQL or rather SQL question than PHP.

$sql = "SELECT fleet_no, fueling_date, quantity, price FROM table_name WHERE  month_column = '$submitted_month' ";
mysql_query($sql);

You have to add another column month_column

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.