src.dualinventive.com/mtinfo/dist/webroot/main/include/db_dvp_app.php

90 lines
2.3 KiB
PHP

<?php
/** \file include\db_dvp_app.php
* \brief DI database functions - dvp app
* \author Bram Lentjes, Core|Vision
* \version 1.0
* \date: 24-02-2015
*
* This file contains database functions for the dvp app
*/
/**
* Store the dvp data
*
* Inputs:
* - data: array of data that must be stored
* - achternaam
* - voornaam
* - mobielnr
* - email
* - bedrijf
* - uuid
* - image_base64
*
* Return: (1/0)(OK/ERROR)
*/
function store_dvp_data($data){
// Check if argument is an array
if(!is_array($data)){
// Failed ($data is no array)
return 0;
}
// Create query to store data into the dvp_app table
$query = "INSERT INTO dvp_app (achternaam, voornaam, mobielnr, email, bedrijf, uuid, image_base64) VALUES (";
$query .= "'" . specialchars($data['achternaam']) . "',";
$query .= "'" . specialchars($data['voornaam']) . "',";
$query .= "'" . specialchars($data['mobielnr']) . "',";
$query .= "'" . specialchars($data['email']) . "',";
$query .= "'" . specialchars($data['bedrijf']) . "',";
$query .= "'" . specialchars($data['uuid']) . "',";
$query .= "'" . specialchars($data['image_base64']) . "')";
// Store data into database and check if it's successfully stored
if(db_store_data($query)){
// Successfully stored
return 1;
}
// Failed
return 0;
}
/**
* Get the dvp data
*
* Inputs: -
*
* Return: Array with all data (without the image_base64)
*/
function get_dvp_data(){
// Create query to store data into the dvp_app table
$query = "SELECT id, voornaam, achternaam, mobielnr, email, bedrijf, uuid FROM dvp_app ORDER BY id DESC";
// Store data into database and check if it's successfully stored
$data = db_fetch_data($query);
return $data;
}
/**
* Get the dvp image_base64
*
* Inputs: id
*
* Return: image_base64
*/
function get_dvp_image_base64($id){
// Create query to store data into the dvp_app table
$query = "SELECT image_base64 FROM dvp_app WHERE id = " . $id. "";
// Store data into database and check if it's successfully stored
$data = db_fetch_data($query);
return $data;
}
?>