public function gettestuser($pin){ $stmt = $this->con->prepare("SELECT * FROM test_category WHERE $value = 't' pin = ?"); $stmt->bind_param("s",$pin); $stmt->execute(); return $stmt->get_result()->fetch_assoc(); }
<?php require_once '../include/DbOperations.php'; $response = array(); if($_SERVER['REQUEST_METHOD']=='POST'){ if(isset($_POST['reg_pin'])){ $db = new DbOperations(); $test_category = $db->gettestuser($_POST['reg_pin']); var_dump($test_category); $response['error'] = false; $response['pid'] = $test_category['pid']; $response['name'] = $test_category['name']; $response['pin'] = $test_category['pin']; $response['a'] = $test_category['a']; $response['b'] = $test_category['b']; $response['ho'] = $test_category['ho']; $response['ll'] = $test_category['ll']; $response['c'] = $test_category['c']; $response['d'] = $test_category['d']; }else{ $response['error'] = true; $response['message'] = "Required fields are missing"; } } echo json_encode($response); ?>
SELECT * FROM test_category WHERE $value = 't' AND pin = '?'
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)