Log in

View Full Version : Simple Question re syntax



kuau
07-07-2008, 05:20 PM
Can someone please tell me what this command means exactly? The part I don't understand is ",NULL as EventID". Thanks.


$query = "SELECT categories.*, NULL as EventID FROM categories WHERE IsActive = 1 AND PkID > 0 ORDER BY CategoryName";

allahverdi
07-07-2008, 06:04 PM
Null will be EventID ?!

but didn't understand why null ><

kuau
07-07-2008, 08:13 PM
I don't understand why NULL either, which is why I am asking. I didn't write the code. I just have to make it work and some of it does weird stuff and I'm trying to understand if there is an error. I hate supporting other people's code. Is it even a correct statement? What does "NULL as EventID" mean?

pngsigut
07-07-2008, 11:57 PM
it is a mysql querry calling the categories table or database and i think it is attempting to print the categories but hide the database id for that category this may help with why i am not sure with out seeing more code.

problem with null (http://dev.mysql.com/doc/refman/5.0/en/problems-with-null.html)

kuau
07-11-2008, 10:27 PM
Is it possibly a shorthand way of saying:

$EventID = "NULL";
SELECT * FROM categories AS EventID WHERE...

PS. We ended up dropping this software package because the guy who sold it to us (and who wrote it) was a total jerk, and it didn't work properly & he was unwilling to address the problems. Life is too short. Geesh... open source is definitely the way to go. But I am trying to learn MySQL and could not find this usage in the MySQL documentation. Maybe that's why it didn't work haha.