Example #1
0
                foreach ($row as $key => $val) {
                    $obj->{$key} = $val;
                }
                $result->rows[] = $obj;
            }
            $stmt->free_result();
        }
        $stmt->close();
    }
    $mysqli->close();
    return $result;
}
function getRefArray($a)
{
    if (strnatcmp(phpversion(), '5.3') >= 0) {
        $ret = array();
        foreach ($a as $key => $val) {
            $ret[$key] =& $a[$key];
        }
        return $ret;
    }
    return $a;
}
// $arrParams = array('siss','','', '', '');
// $result = iQuery( 'SELECT * FROM `test_table` WHERE `sex`=? AND `active`=?', $arrParams);
$arrParams = null;
$result = iQuery('SELECT * FROM `routes', '');
// print_r($result->rows);
$js = json_encode($result->rows);
echo $js;
// echo phpinfo();
Example #2
0
 public function actionDelete()
 {
     $id = $_POST['id'];
     $sql = "delete from convey_answers where id=" . $id;
     iQuery($sql);
     responseJSON(['success' => true]);
 }
error_reporting(E_ALL);
ini_set('display_errors', '1');
//Parse the information from the personal details form on to the system
if (isset($_POST['firstname']) && isset($_POST['lastname']) && isset($_POST['dob']) && isset($_POST['gender']) && isset($_POST['phone']) && isset($_POST['email']) && isset($_POST['username']) && isset($_POST['password'])) {
    $cid = $_GET['id'];
    $firstname = $_POST['firstname'];
    $lastname = $_POST['lastname'];
    $dob = $_POST['dob'];
    $gender = $_POST['gender'];
    $phone = $_POST['phone'];
    $email = $_POST['email'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    //Check if the new customer details exists in the db already
    $sql = "UPDATE customers SET firstname='{$firstname}', lastname='{$lastname}', dob='{$dob}', gender='{$gender}', phone='{$phone}', email='{$email}', username='******', password='******' WHERE id='{$cid}'";
    $res = iQuery($sql);
    header("location: customer_details.php");
    exit;
}
//Get all of the information for the selected customer id and display it on the form bellow for edit purposes
if (isset($_GET['cid'])) {
    $targetID = $_GET['cid'];
    $sql = "SELECT * FROM customers WHERE id='{$targetID}'";
    $res = query($sql);
    if ($res) {
        foreach ($res as $row) {
            $firstname = $row["firstname"];
            $lastname = $row["lastname"];
            $dob = $row["dob"];
            $gender = $row["gender"];
            $phone = $row["phone"];
    $phone = $_POST['phone'];
    $email = $_POST['email'];
    $username = $_POST['username'];
    $password = $_POST['password'];
    //Check if the new customer detials exists in the db already
    $sql = "SELECT * FROM customer WHERE firstname='{$firstname}'";
    $res = query($sql);
    if ($res) {
        //evaluate the count
        echo 'The customer details are already on the system. Please add new details, <a href="customer_details.php">Update Details</a>';
        exit;
    }
    //add this information to the databse now
    $sql = "INSERT INTO customers (firstname, lastname, dob, gender, phone, email, username, password) VALUES('{$firstname}','{$lastname}','{$dob}','{$gender}','{$phone}', '{$email}', username, password)";
    // Execute the query
    $insert = iQuery($sql);
    $cid = $_SESSION['lastInsertID'];
}
//This block gathers the data from the db in order to be displayed later on the webpage
$details_list = "";
$sql = "SELECT * FROM customers";
$res = query($sql);
// Get the output from products in the database
if ($res) {
    foreach ($res as $row) {
        $firstname = $row["firstname"];
        $lastname = $row["lastname"];
        $dob = strftime("%b %d %Y", strtotime($row["dob"]));
        $gender = $row["gender"];
        $phone = $row["phone"];
        $email = $row["email"];
Example #5
0
 public function actionSurveyItem()
 {
     $fl = $this->getConveyFile(self::SURVEYID);
     $data = json_decode($fl);
     $id = $_GET['id'];
     $sql = "select * from convey_answers where id=" . $id;
     $res = iQuery($sql);
     $this->render("show", ['convey' => $data, 'data' => $res['result'][0]]);
 }