<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Test extends CI_Controller {
public function __construct()
{
parent::__construct();
}
public function index()
{
$id = 4;
$sql = "SELECT * FROM mytable WHERE id = ?";
$q = $this->db->conn_id->prepare($sql);
$q->bindValue(1, $id, PDO::PARAM_INT);
$q->execute();
print_r($q->fetch(PDO::FETCH_ASSOC));
}
}