Welcome Guest, Not a member yet? Register   Sign In
Query Bindings Problem
#3

(06-10-2020, 09:15 PM)php_rocs Wrote: @abelhermar,

What version of CI are you using?  Also, have you tried running your query directly in the database to make sure it actually works?  Also, have you tried using the CI profiler ( https://codeigniter.com/userguide3/gener...pplication ) to see what query CI generates and then see if it actually works in the database?

Hi!!, I use CodeIgniter 3.1.10.

The problem in query is when I use a string value, for example:
$var1 = 1;
$var2 = 2;
$var3 = 3;

$sentence = "SELECT column1, column2, column3 FROM table WHERE column1 = ? AND column2 = ? and column3 = ?";
$query = $this->db->query($sentence, array(intval($var1), intval($var2), intval($var3)));

If only send a integer values, the query work's perfectly,

$var = "A";
I don´t know If I'm using correctly the parameters in sentence
$this->db->query($sentence, array(strval($var));

I'm going to read the documentacion about CI profiler, thank's.
Reply


Messages In This Thread
Query Bindings Problem - by abelhermar - 06-10-2020, 08:12 AM
RE: Query Bindings Problem - by php_rocs - 06-10-2020, 09:15 PM
RE: Query Bindings Problem - by abelhermar - 06-12-2020, 08:06 AM
RE: Query Bindings Problem - by dave friend - 06-12-2020, 10:17 AM
RE: Query Bindings Problem - by abelhermar - 06-12-2020, 12:03 PM
RE: Query Bindings Problem - by dave friend - 06-12-2020, 06:58 PM
RE: Query Bindings Problem - by abelhermar - 06-15-2020, 10:47 AM
RE: Query Bindings Problem - by php_rocs - 06-15-2020, 06:53 PM



Theme © iAndrew 2016 - Forum software by © MyBB