The example in the link below may help you:http://www.nuelectronics.com/estore/?p=14
I did not work with the ethernet shield yet, but if I were you, I would ask the web server do the comparison, and just let it return the value of this comparison. This would save you one trip to the server.
To recap, your arduino code would:
1. measure a value x;
2. send a request (through the ethernet shield web client) to the web server, passing the value x as parameter;
3. receive a response with the result; the response could be as simple as a one character HTML page (beside all the HTML tags, of course).
Your web server code would:
1. read the parameter x;
2. save or not this value (x) to mysql;
3. read another value from mysql;
4. perform the comparison;
5. return the result.
I hope this helps.