示例#1
0
<?php

include "../../DAL/dbConfig.php";
try {
    $userName = htmlspecialchars($_POST["user"]);
    $password = htmlspecialchars($_POST["password"]);
    $sqli = dbConfig::connectDb();
    $error = false;
    // Check connection
    if ($sqli->connect_error) {
        $sqli->exit();
        $error = true;
    }
    //insert variables
    $Categorys = array();
    $IDs = array();
    $stmt = $sqli->prepare("CALL getCategorys();");
    if ($stmt->execute() === TRUE) {
        $stmt->bind_result($idCategory, $category);
        while ($stmt->fetch()) {
            $IDs[] = $idCategory;
            $Categorys[] = $category;
        }
    } else {
        $error = true;
    }
    $stmt->close();
    $sqli->close();
} catch (Exception $e) {
    $error = true;
}