@@ -10,10 +10,14 @@ function get_monthly(){
1010 AND YEAR(created_at) = YEAR(CURRENT_TIMESTAMP) " ;
1111 $ stmt = $ db ->prepare ($ sql );
1212 $ stmt ->execute ();
13-
1413 $ results = $ stmt ->fetchAll ();
1514 foreach ($ results as $ row ) {
16- echo $ row ['total_earnings ' ];
15+ if ($ row ['total_earnings ' ] == null ){
16+ echo "0 " ;
17+ }
18+ else {
19+ echo $ row ['total_earnings ' ];
20+ }
1721 }
1822}
1923
@@ -27,8 +31,12 @@ function get_yearly(){
2731 $ stmt = $ db ->prepare ($ sql );
2832 $ stmt ->execute ();
2933 $ results = $ stmt ->fetchAll ();
34+ if ($ results ){
3035 foreach ($ results as $ row ) {
3136 echo $ row ['total_earnings ' ];
37+ }}
38+ else {
39+ echo "0 " ;
3240 }
3341}
3442
@@ -54,8 +62,12 @@ function get_processing(){
5462 $ stmt = $ db ->prepare ($ sql );
5563 $ stmt ->execute ();
5664 $ results = $ stmt ->fetchAll ();
65+ if ($ results ){
5766 foreach ($ results as $ row ) {
5867 echo $ row ['total_processing ' ];
68+ }}
69+ else {
70+ echo "0 " ;
5971 }
6072}
6173
@@ -67,8 +79,12 @@ function get_folding(){
6779 $ stmt = $ db ->prepare ($ sql );
6880 $ stmt ->execute ();
6981 $ results = $ stmt ->fetchAll ();
82+ if ($ results ){
7083 foreach ($ results as $ row ) {
7184 echo $ row ['total_folding ' ];
85+ }}
86+ else {
87+ echo "0 " ;
7288 }
7389}
7490
@@ -80,8 +96,12 @@ function get_ready(){
8096 $ stmt = $ db ->prepare ($ sql );
8197 $ stmt ->execute ();
8298 $ results = $ stmt ->fetchAll ();
99+ if ($ results ){
83100 foreach ($ results as $ row ) {
84101 echo $ row ['total_ready ' ];
102+ }}
103+ else {
104+ echo "0 " ;
85105 }
86106}
87107
@@ -93,8 +113,12 @@ function get_claimed(){
93113 $ stmt = $ db ->prepare ($ sql );
94114 $ stmt ->execute ();
95115 $ results = $ stmt ->fetchAll ();
116+ if ($ results ){
96117 foreach ($ results as $ row ) {
97118 echo $ row ['total_claimed ' ];
119+ }}
120+ else {
121+ echo "0 " ;
98122 }
99123}
100124
@@ -105,7 +129,11 @@ function get_customers(){
105129 $ stmt = $ db ->prepare ($ sql );
106130 $ stmt ->execute ();
107131 $ results = $ stmt ->fetchAll ();
132+ if ($ results ){
108133 foreach ($ results as $ row ) {
109134 echo $ row ['total_customers ' ];
135+ }}
136+ else {
137+ echo "0 " ;
110138 }
111139}
0 commit comments