Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
apisub
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Stephane Crozat
apisub
Commits
743643e1
Unverified
Commit
743643e1
authored
Nov 07, 2018
by
Rémy Huet
💻
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Encapsulation and params types
parent
1fbeb0e3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
lib/db.php
lib/db.php
+5
-5
No files found.
lib/db.php
View file @
743643e1
...
...
@@ -4,7 +4,7 @@ class DB {
private
$conn
;
function
__construct
()
{
public
function
__construct
()
{
include
'connexion.php'
;
try
{
$this
->
conn
=
new
PDO
(
'pgsql:host=localhost;port=5432;dbname=apisub'
,
$db_user
,
$db_pass
);
...
...
@@ -13,7 +13,7 @@ class DB {
}
}
function
subList
(
string
$utclogin
)
:
array
{
public
function
subList
(
string
$utclogin
)
:
array
{
$sql
=
'SELECT *
FROM vsubscription
WHERE utclogin=:utclogin'
;
...
...
@@ -26,7 +26,7 @@ class DB {
return
$res
;
}
function
apiList
(
string
$semester
,
int
$year
)
:
array
{
public
function
apiList
(
string
$semester
,
int
$year
)
:
array
{
$sql
=
'SELECT *
FROM vApi
WHERE semester=:semester AND year=:year'
;
...
...
@@ -40,7 +40,7 @@ class DB {
return
$res
;
}
function
subToApi
(
$utclogin
,
$api
)
:
bool
{
public
function
subToApi
(
string
$utclogin
,
int
$api
)
:
bool
{
$today
=
date
(
'Ymd'
);
$sql
=
'INSERT INTO subscribe(utclogin, api, subdate) VALUES (:utclogin, :api, :today)'
;
$st
=
$this
->
conn
->
prepare
(
$sql
);
...
...
@@ -53,7 +53,7 @@ class DB {
return
$res
;
}
function
unsubToApi
(
$utclogin
,
$api
)
:
bool
{
public
function
unsubToApi
(
string
$utclogin
,
int
$api
)
:
bool
{
$sql
=
'DELETE FROM subscribe WHERE utclogin=:utclogin AND api=:api'
;
$st
=
$this
->
conn
->
prepare
(
$sql
);
$res
=
$st
->
execute
([
...
...
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