Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
KLUGLUG
Blood Service Portal
Commits
f9d9890c
Commit
f9d9890c
authored
Nov 08, 2019
by
rama chandra
Browse files
Delete bulkupload.php
parent
69e50a13
Changes
1
Show whitespace changes
Inline
Side-by-side
admin/bulkupload.php
deleted
100644 → 0
View file @
69e50a13
<?php
require
(
'db.php'
);
include
(
"auth.php"
);
if
(
isset
(
$_POST
[
"Import"
])){
$filename
=
$_FILES
[
"file"
][
"tmp_name"
];
if
(
$_FILES
[
"file"
][
"size"
]
>
0
)
{
$file
=
fopen
(
$filename
,
"r"
);
while
((
$getData
=
fgetcsv
(
$file
,
10000
,
","
))
!==
FALSE
)
{
$sql
=
"INSERT into bloo (`id`, `uname`, `blood`, `age`, `mobile`, `city`, `dd`)
values ('
$getData[0]','$getData[1]','$getData[2]','$getData[3]','$getData[4]','$getData[5]','$getData[6]
')"
;
$result
=
mysqli_query
(
$con
,
$sql
);
if
(
!
isset
(
$result
))
{
echo
"<script type=
\"
text/javascript
\"
>
alert(
\"
Invalid File:Please Upload CSV File.
\"
);
window.location =
\"
dashboard.php
\"
</script>"
;
}
else
{
echo
"<script type=
\"
text/javascript
\"
>
alert(
\"
CSV File has been successfully Imported.
\"
);
window.location =
\"
dashboard.php
\"
</script>"
;
}
}
fclose
(
$file
);
}
}
if
(
isset
(
$_POST
[
"Export"
])){
header
(
'Content-Type: text/csv; charset=utf-8'
);
header
(
'Content-Disposition: attachment; filename=data.csv'
);
$output
=
fopen
(
"php://output"
,
"w"
);
fputcsv
(
$output
,
array
(
'ID'
,
'Donor Name'
,
'Blood Group'
,
'Age'
,
'Mobile'
,
'City'
,
'Last Donated Months'
));
$query
=
"SELECT * from bloo ORDER BY id DESC"
;
$result
=
mysqli_query
(
$con
,
$query
);
while
(
$row
=
mysqli_fetch_assoc
(
$result
))
{
fputcsv
(
$output
,
$row
);
}
fclose
(
$output
);
}
?>
\ No newline at end of file
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