Re: Checking Post Data against DB Data

From: Date: Thu, 12 Jul 2007 03:08:57 +0000
Subject: Re: Checking Post Data against DB Data
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-258665@lists.php.net to get a copy of this message
kvigor wrote:
OK Chris, I understand that we're checking checking the form data and escaping it, but can explain what's going on in the WHERE clause and 1=1 tad bit more.
Instead of looking at all records in your original attempt (which will work fine for 10 records), you limit what you are looking at (which works a lot better for 50,000 records). The 1=1 is something that the database will remove internally but basically it stops an invalid query: select * from table where a='b' and c='d' and That's why I said you can either remove the last and: select * from table where a='b' and c='d' or add 1=1: select * from table where a='b' and c='d' and 1=1 They work out the same. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.general (#258665) next »