NYCPHP Meetup

NYPHP.org

[nycphp-talk] xmlhttp: conventions/practices for throwing error?

David Mintz dmintz at davidmintz.org
Fri Mar 10 12:19:32 EST 2006


Hey all,

I'm writing some PHP that expects some GET data, uses it to build SQL
query, XMLifies the data from the result and echos it. The client is
Javascript that submits an xmlhttp request. Suppose some of the GET input
doesn't validate. Is there a convention/best practice for throwing an
error to signal the client something is wrong -- e.g., do you send an HTTP
error code in a header or some such? Or just echo something like
<error>error message here</error>?

Thanks,

---
David Mintz
http://davidmintz.org/

Amendment IV

The right of the people to be secure in their
persons, houses, papers, and effects, against
unreasonable searches and seizures, shall not be
violated, and no Warrants shall issue, but upon
probable cause, supported by Oath or affirmation,
and particularly describing the place to be
searched, and the persons or things to be seized.



More information about the talk mailing list