Welcome Guest, Not a member yet? Register   Sign In
DB queries NOT failing when they should.
#1

[eluser]boltsabre[/eluser]
I've just come across something a little strange.

When doing a DB SELECT query (either by using active records or a hand coded SQL statement executed with $this->db->query()) , and I pass it a bogus id like "1abc" it executes and returns the record 1. Likewise passing an id like "1_1" returns the record 1. "11abc" returns 11, and so on.

To my thinking this SHOULD not happen, I have no record 1abc, 1_1, 11abc, etc. The id column is an primary_key auto_increment int(11)

Is this a automatic "cleansing" done internally by CI, or my DB engine (MySQL)?

Is there anyway to disable it? I want id=1abc to fail.

Why? Because if it does fail then I can gracefully throw a 404 message/http header and be done with it. As it currently operates it's opening the door to duplicate content issues and now I have to incorporate the use of the rel=canonical tag.

Any thoughts?


Messages In This Thread
DB queries NOT failing when they should. - by El Forum - 12-06-2012, 04:02 AM
DB queries NOT failing when they should. - by El Forum - 12-06-2012, 04:14 AM
DB queries NOT failing when they should. - by El Forum - 12-06-2012, 04:24 AM



Theme © iAndrew 2016 - Forum software by © MyBB