Welcome Guest, Not a member yet? Register   Sign In
v318 db parser bug (maybe, perhaps)
#1

up to and including v312, i was able to use queries like the following
PHP Code:
SELECT ..... FROM .... WHERE (a.transdate >= "?") AND (p.prva_id>0) AND (p.prod_id=?) 

Today i made the quantum leap to v318 and such queries crash on the part "(p.prod_id=?)".
Now it will only work if i use (p.prod_id="?") ie enclose the question mark in quotes
Switch back to v312 and it's ok
I don't know if this is a bug or if I've just been lucky in always getting away with sloppy coding.
The quotes are needed for e.g. a date or text but I've never had to use them for integers
Bill
Reply
#2

Your not showing the array that's used for it.

Show all of the method code so that we can help you.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

well the full query is shown below. the point i was making is that the site has worked perfectly (very many thanks to the ci developers) in all versions of ci upto and including 3.12 which is what i am using now. when i changed to v318 this morning, it crashed and pointed the error at the final question mark in the query. it only works in v318 if i enclose the question mark in quotes. this was the first database call and my code is littered with queries where question marks related to integers are not in quotes so there was no point in going further with the testing. i'd rather stick with v312 than go back and change a mountain of queries. its no big deal, the site works great so if it aint broke dont fix it
$this->db->query('SELECT a.trans_id AS "id" FROM transitems a LEFT JOIN prodpacks.p ON p.c2g=a.prva_id
WHERE (a.transdate >= "?") AND (a.data_type=1) AND (prva_id>0) AND (p.prod_c2g=?) LIMIT 20',array($date,$prodid))
$date is a string, $prodid is an integer.
bill
Reply
#4

May not be broke but updates are also use to fix Security leaks etc;
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB