John, > > > I can see no explanation in the data stored in the table. > > The important thing is what MySQL 'sees'! > > > > You've already started testing your premise <<<ASSUMING all records > > are > > either "input" or "published">>> One suggestion would be to use the > > MySQL client for investigations, then if you don't get the same > > result > > from PHP you have a hint of where the problem lies.
> OK, now I'm REALLY puzzled. > I executed this query: > $sql = "SELECT * > FROM $table_name > ORDER BY status > "; > > Sure enough, mysql found no value in status about a third of the > time. (The table comes back with the empty status rows, then "input" > and finally "published.") This explains why WHERE status = > "published" doesn't return the same results as WHERE status <> > "input". > > But here's the rub: > When I do an individual check on each of the "empty" status records, > every one of them has "published" in the status field and the status > shows as "published" when I sort by a different field than "status." > > How can the data be in the record when I ORDER BY "lname" (a varchar > text field) and no data be found when I ORDER BY "status" (a varchar > text field)? So referring back to my arcane language above, you 'see' "published" but MySQL 'sees' something different. For example it would not be obvious to you or I that there is a space after the "d", but the computer still 'sees' it. So contrary to what our senses tell us, it is unlikely that there is a fault with MySQL's = and <> functionality, but more that there's something (literally) unforeseen about the data. May I refer you back to my previous message. If you try: SELECT status, COUNT(status) AS number_of_letters FROM -*-table_name-*- GROUP BY status; This will tell you how many variations of value there are (the number of rows returned beyond "published" and "input"). Afterwards, vary it slightly by wrapping a "marker' around the status row data, eg CONCAT( "~", status, "~" ), and that will show you if there are any 'space' characters. Recommend you execute this ins the MySQL client or a management package (rather than PHP), and the former would make it very easy for you to copy-paste the entire query and results into any future email msg (please?). You've broken the back of it now! Regards, =dn --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php