Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Projet_idaw
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Liang Wu
Projet_idaw
Commits
dd7cce11
Commit
dd7cce11
authored
Apr 05, 2020
by
Raulin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
read indicateurs sans l'id
parent
76c7c884
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
0 deletions
+97
-0
read_indicateur.php
api/read_indicateur.php
+38
-0
indicateurs.php
indicateurs.php
+59
-0
No files found.
api/read_indicateur.php
0 → 100644
View file @
dd7cce11
<?php
require_once
(
"template.php"
);
$tab
=
array
();
$requete0
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Fruit'"
;
$rep0
=
$mysqli
->
query
(
$requete0
);
$result0
=
$rep0
->
fetch_all
();
$tab
[
0
]
=
$result0
[
0
][
0
];
$requete1
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Legume'"
;
$rep1
=
$mysqli
->
query
(
$requete1
);
$result1
=
$rep1
->
fetch_all
();
$tab
[
1
]
=
$result1
[
0
][
0
];
$requete2
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Feculent'"
;
$rep2
=
$mysqli
->
query
(
$requete2
);
$result2
=
$rep2
->
fetch_all
();
$tab
[
2
]
=
$result2
[
0
][
0
];
$requete3
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Laitage'"
;
$rep3
=
$mysqli
->
query
(
$requete3
);
$result3
=
$rep3
->
fetch_all
();
$tab
[
3
]
=
$result3
[
0
][
0
];
$requete4
=
"SELECT COUNT(*) FROM `journal` JOIN `aliments` ON `journal`.`id_aliment`=`aliments`.`id_aliment` WHERE `type`='Sucrerie'"
;
$rep4
=
$mysqli
->
query
(
$requete4
);
$result4
=
$rep4
->
fetch_all
();
$tab
[
4
]
=
$result4
[
0
][
0
];
echo
reponse_json
(
$tab
);
indicateurs.php
0 → 100644
View file @
dd7cce11
<head>
<meta
charset=
"utf-8"
/>
<script
src=
"https://code.jquery.com/jquery-3.4.1.js"
integrity=
"sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="
crossorigin=
"anonymous"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"https://cdn.datatables.net/1.10.20/css/jquery.dataTables.css"
>
<script
type=
"text/javascript"
charset=
"utf8"
src=
"https://cdn.datatables.net/1.10.20/js/jquery.dataTables.js"
></script>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
(
'#table_aliments'
).
DataTable
();
resetForm
();
}
);
function
resetForm
()
{
document
.
getElementById
(
"id"
).
value
=
""
document
.
getElementById
(
"aliment"
).
value
=
""
;
document
.
getElementById
(
"calories"
).
value
=
""
;
document
.
getElementById
(
"cat"
).
value
=
""
;
document
.
getElementById
(
"submit_button"
).
value
=
"Ajouter"
;
};
</script>
<script
type=
"text/javascript"
>
$
(
document
).
ready
(
function
()
{
$
.
getJSON
(
'https://eden.imt-lille-douai.fr/~charlotte.raulin/Projet/api/read_indicateur.php'
,
function
(
json
){
table
=
$
(
'#tbody_indicateur'
);
table
.
html
(
''
);
echo
(
json
);
echo
(
json
[
0
]);
// cf. https://api.jquery.com/jQuery.getJSON/
// $.each( json, function( key, val ) {
// // table.append('
<
tr
><
td
>
'+val[0]+'
<
/td><td>'+val
[
1
]
+'</
td
><
td
>
'+val[2]+'
<
/td><td><button '
+
// // 'onclick="onEdit('+val[0]+',\''+val[1]+'\',\''+val[2]+'\')">Modifier
<
/button></
td
><
/tr>'
)
;
// table.append('
<
tr
><
td
>
'+val[0]+'
<
/td><td>'+val
[
1
]
+'</
td
><
td
>
'+val[2]+'
<
/td><td>'+val
[
3
]
+'</
td
><
td
>
'+val[4]+'
<
/td></
tr
>
');
// });
}
);
});
</script>
</head>
<div
style=
"margin-right:100px"
>
<table
id=
"table_indicateur"
class=
"dataTable"
style=
"color : #212529; "
>
<thead>
<tr>
<th>
Fruit
</th>
<th>
Legume
</th>
<th>
Feculent
</th>
<th>
Laitage
</th>
<th>
Sucrerie
</th>
</tr>
</thead>
<tbody
id=
"tbody_indicateur"
><tbody>
</table>
</div>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment