<?php
/**
 * Created by PhpStorm.
 * User: Ludah
 * Date: 8/28/2017
 * Time: 8:26 PM
 */

function v_get_all_customers($dbc){
    $query = "
        SELECT * FROM v_customer_info    
    ";
    $q = mysqli_query($dbc,$query);
    $data = array();
    while ($row = mysqli_fetch_assoc($q)){
        $data[] = $row;
    }
    return $data;
}

function v_get_customerInfo_by_id($dbc,$customerID){
    $q = mysqli_query($dbc,"SELECT * FROM v_customer_info WHERE id = '$customerID'");
    $data = mysqli_fetch_assoc($q);
    return $data;
}
function v_get_customerInfo_by_phone($dbc,$phoneNum){
    $q = mysqli_query($dbc,"SELECT * FROM v_customer_info WHERE phoneNum = '$phoneNum'");
    $data = mysqli_fetch_assoc($q);
    return $data;
}

function v_check_number_exist($dbc,$phoneNum){
    $q = mysqli_query($dbc,"SELECT * FROM v_customer_info WHERE phoneNum = '$phoneNum'");
    if(mysqli_num_rows($q)> 0){
        return true;
    }
}
