Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
Summative_Sam_Markey
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
sam.markey
Summative_Sam_Markey
Commits
9f5eba40
Commit
9f5eba40
authored
Apr 29, 2021
by
sam.markey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fetching data script
parent
99b36dd7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
fetch_data.php
OTHER_INFORMATION/php files/fetch_data.php
+62
-0
No files found.
OTHER_INFORMATION/php files/fetch_data.php
0 → 100644
View file @
9f5eba40
<?php
if
(
isset
(
$_GET
[
'table'
]))
{
$table
=
trim
(
htmlspecialchars
(
$_GET
[
'table'
]));
if
(
strcmp
(
$table
,
'museum'
)
==
0
||
strcmp
(
$table
,
'item_museum'
)
==
0
){
$language
=
$_GET
[
'language'
];
getTable
(
$table
,
$language
);
}
else
{
getTable
(
$table
,
""
);
}
}
else
{
echo
'check_isset'
;
}
function
getTable
(
$tablename
,
$languageType
)
{
require_once
'connect_db.php'
;
$stmt
=
mysqli_stmt_init
(
$connect
);
if
(
strcmp
(
$tablename
,
'museum'
)
==
0
||
strcmp
(
$tablename
,
'item_museum'
)
==
0
){
$sql
=
'SELECT * FROM '
.
$tablename
.
" WHERE language='"
.
$languageType
.
"';"
;
}
else
{
$sql
=
'SELECT * FROM '
.
$tablename
.
";"
;
}
if
(
!
mysqli_stmt_prepare
(
$stmt
,
$sql
))
{
echo
"ERROR: "
.
$sql
;
}
else
{
mysqli_stmt_execute
(
$stmt
);
$dataArray
=
array
();
if
(
$resultData
=
mysqli_stmt_get_result
(
$stmt
))
{
while
(
$row
=
mysqli_fetch_assoc
(
$resultData
))
{
$rows
[]
=
$row
;
}
echo
json_encode
(
JsonVerify
(
$rows
));
}
}
mysqli_stmt_close
(
$stmt
);
}
function
JsonVerify
(
$var
)
{
if
(
is_array
(
$var
))
{
foreach
(
$var
as
$key
=>
$value
)
{
$var
[
$key
]
=
JsonVerify
(
$value
);
}
}
elseif
(
is_string
(
$var
))
{
return
mb_convert_encoding
(
$var
,
"UTF-8"
,
"UTF-8"
);
}
return
$var
;
}
\ 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