Skip to content

An automatic chart generated by Google Charts, what i've done some modifications to push some informations of my BD, doing a separation by month or by day

License

Notifications You must be signed in to change notification settings

brahmsr/automatic-chart-php-mysql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Automatic chart/graph with php mysql NPM

An automatic chart generated by Google Charts, what i've done some modifications to push some informations of my BD, doing a separation by month or by day. I've created an database named 'controle_caixa' what means 'cashflow control' and I have a table 'transacoes' what means 'transactions', in this table we have:

id - primary key autoincrement

movimentacao - varchar(220) (what is a description of the transaction)

valor_m - varchar (220) (it's the value of the transaction)

tipo_m - tinyint (this will inform if it's a expense or gain)

metodo_m - varchar (220) (it's a info about the tipe of transaction: debit, credit, money, banking transaction)

criado_em - timestamp (CURRENT_TIMESTAMP) (to have a control about the transactions by day or month)

After that i've gone in Google Charts and obtained the default code of the area graph. I've deleted the default data what comes with the chart and started with a new archive named graph.php of course I've done a dbcon.php but this archive i've used via include('graph.php')

dbcon.php

in case of you want to do just a page with this chart I will describe the content of the dbcon.php:

<?php

$host = "localhost";
$username = "root";
$password = "";
$database = "controle_caixa";

$con = mysqli_connect("$host", "$username", "$password", "$database");

if (!$con)
{
    die ("Erro na conexao: " . mysqli_connect_error());
}
    

?>

We have 2 ways to add this connection to our code, by adding the all code in the start or creating a file named dbcon.php and inserting the

include('dbcon.php');

The second way it's better to create a clean code!

Ensure you customize the database connection details (host, username, password, database) according to your environment.

Feel free to explore and adapt the code to fit your specific requirements. If you have any questions or suggestions, please don't hesitate to reach out!

About

An automatic chart generated by Google Charts, what i've done some modifications to push some informations of my BD, doing a separation by month or by day

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages