I thought this was a MySQL question, or something that could be solved using
a creative SQL string, but after looking through the MySQL manual, I don't
think I can handle this with the database alone. According to the manual,
MySQL always sorts NULL values first - I want them last. I have a last_name
field that sometimes contains people's last names, sometimes they choose not
to enter their last names. I want those who don't enter a last name to end
up last on the list.

Right now I have: $result = mysql_query("SELECT * FROM new_miatapix ORDER BY
last_name LIMIT $page, 20");

Am I going to have to do two queries here, then store them somehow using an
array? It seems like I'm going to have to do one query to get all NULL
values for last_name, then do another query to get all NOT NULL values for
last_name, but how would I handle that after I get it to PHP?

Or can I use some PHP function to sort $result to place all NULL values
last? I'd check the PHP manual, but it seems to not be responding well at
the moment.

Thanks,

Jason Soza


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to