Welcome Guest, Not a member yet? Register   Sign In
convert value from routes/uri to string
#6

(This post was last modified: 04-14-2019, 07:03 AM by dave friend.)

(04-14-2019, 05:48 AM)DELE Wrote:
(04-13-2019, 03:04 AM)Wouter60 Wrote: You can also try query bindings:

PHP Code:
$sql "SELECT * FROM users WHERE $key = ?";
$this->db->query($sql, array($value)); 

it doesn't work

Did you do this?
It is likely what Wouter60 was implying.

PHP Code:
public function user($key$value)
{
    
$sql "SELECT * FROM users WHERE $key = ?";
    
$query $this->db->query($sql, array($value));
    return 
$query->row();


The double quotes to define the query string are required.

Use of query binding is highly desirable for the security it provides.
Reply


Messages In This Thread
convert value from routes/uri to string - by DELE - 04-13-2019, 01:42 AM
RE: convert value from routes/uri to string - by dave friend - 04-14-2019, 07:01 AM



Theme © iAndrew 2016 - Forum software by © MyBB