Query bugs when not logged in - PostgreSQL
Russell Valentine <russ-98fVsw/2eqlQihsdzhub5di2O/[email protected]> Thu, 27 Nov 2003 13:26:31 -0600
| Newsgroups | gmane.comp.bug-tracking.anthill.devel |
|---|---|
| Organization | Coldstone Labs |
| Message-ID | <[email protected]> |
In functions.inc.php in d_DrawQueryForm or anywhere, where there is a statement like this: SELECT * FROM users WHERE (uid != '$uid') AND (deleted = '0'); If I'm not logged in $uid is a blank string you get a error in PostgreSQL. pg_atoi: zero-length string You can see this by not being logged in and going to 'Query Bug' basicly postgresql doesn't like a blank string to compare to. Something like this works WHERE (uid is not null) AND (deleted = '0'); or WHERE (deleted = '0'); I think there should be a way to account for it if $uid = NULL and use binding variables with PEAR, but I'd have to look it up. I know it is possible in JDBC with Java, I would think it is there in PEAR. I don't know of a easy fix at the moment, unless Mysql has simular syntax or you just check if user is logged in or not and could even take out the (uid != ) thing if not logged in. I'll install MySQL to try to make a compatible statement, having MySQL will also help if I find something in the future. Russell Valentine _______________________________________________ Anthill-workers mailing list Anthill-workers-+mQDA36h6dWw5LPnMra/[email protected] http://vmlinuz.ca/mailman/listinfo/anthill-workers
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.3 (GNU/Linux) iD8DBQE/xk/sO0EDJO5MgRYRAqWgAKCIL2iJCoGUOCuy9d23i3NNXfW8qwCbB5hF H/+UmTVQNNnRX4/ylpvoNNw= =1Ww2 -----END PGP SIGNATURE-----