Electricity Consumption Monitoring Tool Using PHP and MySQL with Source Code


Welcome to the Electricity Consumption Monitoring Tool Using PHP and MySQL! This web application is designed to streamline the process of monitoring and managing electricity consumption data. By leveraging PHP for server-side scripting and MySQL for robust data storage, this tool offers users a seamless experience in tracking their electricity usage over time.

With a user-friendly interface and a range of features, including the ability to add new electricity bills, visualize consumption trends through interactive charts, and compare bill data for insightful analysis, users can gain valuable insights into their energy consumption patterns. Whether you're a homeowner looking to track monthly electricity usage or a business aiming to optimize energy efficiency, this tool provides the tools and capabilities needed to make informed decisions and promote sustainable energy practices.

You may also check some simple PHP and MySQL projects:


  1. Add Electricity Bills: Users can easily add their electricity bills by entering the bill date and amount through a simple form.
  2. Data Visualization: The tool provides a graphical representation of electricity consumption trends over time using Chart.js, enabling users to grasp consumption patterns at a glance.
  3. Bill Comparison: The application calculates and displays the difference in electricity consumption between consecutive bills, aiding in understanding usage variations.
  4. Interactive Interface: Users can interact with the data table, view bill details, and remove bills if needed, enhancing control and customization.

Technologies Used:

  • PHP: Used for server-side scripting and database interactions, ensuring secure and efficient data handling.
  • MySQL: The relational database management system stores and retrieves electricity consumption data, facilitating organized data management.
  • Bootstrap: Provides responsive design elements and components for a visually appealing and user-friendly interface.
  • Chart.js: Enables the creation of interactive charts to visualize electricity consumption trends over time.

How to Use:

  • Adding a Bill:

    • Click on the "+ Add Electricity Bill" button to open the bill entry modal.
    • Enter the bill date and amount in the respective fields.
    • Click the "Add" button to submit the bill details.
  • Viewing and Managing Bills:

    • The table displays all added bills with columns for date, bill amount, consumed amount, and an action button to remove bills.
    • The consumed amount column shows the difference between the current bill and the previous one, aiding in consumption analysis.
    • Click the "X" button in the action column to remove a bill. A confirmation prompt appears before deletion.
  • Data Visualization:

    • The graph section displays a line chart representing electricity consumption each month.
    • Users can hover over data points to view consumption values, providing a visual overview of consumption patterns.

Sample Screenshots of the Project:

Landing Page

Adding Bill Modal

Sample Bills

How to Run?

  • Download and Install XAMPP.
  • Download the provided source code zip file.

Note: The database is included on the provided zip file.


  • Create a database named "electricity_db" in phpMyAdmin MySQL.
  • Extract the provided source code to the htdocs folder.
  • Import the provided SQL file into the created database.
  • Open your browser with the link "http://localhost/electricity-comsumption-monitoring/".

Video Demonstration for Installation/Setup:


In conclusion, the Electricity Consumption Monitoring Tool crafted with PHP, MySQL, and Chart.js presents a comprehensive solution for tracking and analyzing electricity usage patterns. By seamlessly integrating bill consumption calculations into interactive charts, users can gain valuable insights into their energy consumption trends over time, empowering them to make informed decisions about energy management and fostering sustainable practices. With its user-friendly interface and robust functionalities, this tool serves as a valuable asset for individuals and businesses alike in optimizing energy efficiency and promoting environmental responsibility.

That's it! I hope this "Electricity Consumption Monitoring Tool Using PHP and MySQL" will assist you on your programming journey, providing value to your current and upcoming PHP projects.

For additional tutorials and free source code, explore our websites.  

Enjoy Coding :>>

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.

Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.


1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

Add new comment