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

(06-12-2020, 10:17 AM)dave friend Wrote: If the items in the array are the data type that matches what the field handles, you don't need the inval() or strval() functions. If column1 handles integers then you should be able to use either the number 1 or the string '1' and have it work.

What is the datatype of column3?
Hi Dave friend: 

The column3 is char, and query fails only when I use a parameter different to int:

$var1 = 1;
$var2 = 2;

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

I get the response ok.

In other case:
$var1 = 1;
$var2 = "A";

$sentence = "SELECT column1, column2, column3 FROM table WHERE column1 = ? AND column3 = ?";
$query = $this->db->query($sentence, array($var1, $var2));
I get the error response.

Thank's for all!!
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