Re: Checking Post Data against DB Data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux