mysql - Why can't we use :key => value in CodeIgniter's DB library? -


i've used use regular php's pdo:

$data = array(     ":name" => "james",     ":location" => "palo alto, ca" ); 

sql:

select * people name :name , location = :location 

when i've started use codeigniter, won't let me use namespace keys anymore, accepts traditional ? marks.

anyway fix that?

unfortunately, no, there isn't. not codeigniter natively.

it helps remember codeigniter's roots in php4 compliant code (and of things did not recent php 4 -- use custom file searching system substantially slower glob around php 4.3 (4.4? around minimum required version), means old '?' best option @ time.

if feel better using newer style, might better off using pdo classes. they're better , faster anyway. (frankly, use ci's db classes compliance. have strong preference pdo's, since of modern frameworks seem use them). warn you, though, use of pdo's invalidates activerecord framework offered codeigniter. not able use $this->db->select()->from('table')->where($array)->limit(1,4); more importantly, need know differences between different dialects of sql, codeigniter lets avoid (and code won't db agnostic anymore).


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -