Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
legi
soft
gestex
Commits
f4fd7073
Commit
f4fd7073
authored
Jul 24, 2020
by
Gabriel Moreau
Browse files
Add function caterory_new and remove INSERT in code
parent
36d9db39
Changes
2
Hide whitespace changes
Inline
Side-by-side
category-create.php
View file @
f4fd7073
...
@@ -30,11 +30,9 @@ if (!empty($erreur)) {
...
@@ -30,11 +30,9 @@ if (!empty($erreur)) {
exit
();
exit
();
}
}
$sql
=
'INSERT INTO categorie (nom) VALUE (?);'
;
$id_category
=
set_category_new
(
$pdo
,
$categorie
);
$stmt
=
$pdo
->
prepare
(
$sql
);
$stmt
->
execute
(
array
(
$categorie
));
echo
'<br />
a
jout de '
.
$categorie
.
' validée'
;
echo
'<br />
A
jout de
la catégorie
'
.
$categorie
.
' validée'
;
echo
'<br /><br /><a href="equipment-list.php">Suite</a><br /><br />'
;
echo
'<br /><br /><a href="equipment-list.php">Suite</a><br /><br />'
;
?>
?>
...
...
module/db-functions.php
View file @
f4fd7073
...
@@ -151,6 +151,15 @@ function check_category_by_name($pdo, $name) {
...
@@ -151,6 +151,15 @@ function check_category_by_name($pdo, $name) {
// ---------------------------------------------------------------------
// ---------------------------------------------------------------------
function
set_category_new
(
$pdo
,
$name
)
{
$sql
=
'INSERT INTO categorie (nom) VALUE (?);'
;
$stmt
=
$pdo
->
prepare
(
$sql
);
$stmt
->
execute
(
array
(
$name
));
return
$pdo
->
lastInsertId
();
}
// ---------------------------------------------------------------------
function
get_loan_all_by_id_equipment
(
$pdo
,
$id_equipment
)
{
function
get_loan_all_by_id_equipment
(
$pdo
,
$id_equipment
)
{
// recupere l'appareil via l'id qui est mis dans un champs texte (nom) !
// recupere l'appareil via l'id qui est mis dans un champs texte (nom) !
$sql
=
'SELECT * FROM pret WHERE nom = ?;'
;
$sql
=
'SELECT * FROM pret WHERE nom = ?;'
;
...
...
Write
Preview
Supports
Markdown
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