-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
The quick answer is no: you cannot specifically match a certain column
and not match a certain column at the same time.
You are already creating the SQL statements manually, so why not just create
different ones for each situation?
if (historical search) {
$query = "SELECT * FROM difference WHERE clientid = $CLIENTID ORDER BY cartid ASC LIMIT 1";
}
else {
$query = "SELECT * FROM difference WHERE clientid = $CLIENTID AND cartid = $CARTID";
}
More importantly, however, there seems to be a fatal flaw in your process:
> By adding the "ORDER BY cartid ASC LIMIT 1" to the sql statement, the user
> gets the most recent credit amount for that customer entered into the
> system. That is, the credit amount created by the previous invoice.
> ...when the user is creating an invoice, that invoice's cartid (which is
> a random number) is already entered into the system,
If "cartid" is a random number, 'ORDER BY cartid ASC' is not going to do you any good.
- --
Greg Sabino Mullane greg@turnstep.com
PGP Key: 0x14964AC8 200306261048
-----BEGIN PGP SIGNATURE-----
Comment: http://www.turnstep.com/pgp.html
iD8DBQE++wlmvJuQZxSWSsgRAizgAJ9tXUD9i3fhbhPQMw7V9z7AXbSwuQCgkfHg
hsq/uuge0mxcyoj9WqAYkTY=
=0WLM
-----END PGP SIGNATURE-----