I've got a mysql database that we support using phpMyAdmin.

The web site to is really a classifieds website.

The problem here's any time a brand new classified is published (and placed into mysql database), I have to first evaluate it by hand.

My real question is, can there be anyway to inform mysql that "this record is inactive, so don't give it backInch?

I understand of 1 way offcourse, to include a column named "condition" and alter it to "active" for those classifieds that we want active. But can there be every other method included in mysql which does exactly the same?

Quite simply, I dont want the record came back when customers search the web site when the record is not "examined" first by me.


I understand about the WHERE clause, that's not my Q here. Can there be every other method included in phpMyAdmin?


I understand about the WHERE clause, that's not my Q here. Can there be every other method included in phpMyAdmin?

no, it isn't. your should realy make use of a "condition" column to obtain what you would like.

No there's no built-in method. Beside of techniques pointed out above you could attempt using sights to filter inactive records. Rather than:

SELECT * FROM table WHERE status = 'active';

make use of a view:

CREATE VIEW only_active AS SELECT * FROM table WHERE status = 'active';

after which just

SELECT * FROM only_active

Which makes you sure you won't ever get inactive records incidentally.

On the row level you will find no qualities other then ones you specify yourself. So, the reply is definitively no.

Using sights as Piotr referred to may be helpful for you particularly if you turn back situation and

  • relabel the initial table
  • produce a view in it's title which will return only 'reviewed' records

By doing this the answer may be transparent for your application.

Couple of notes:

  • The database doesn't care if myphpadmin or other client/application is searching in the data, all customers are basically equal therefore the implication is the fact that that which you request cannot be possible (otherwise, wouldso would this hiding mechanism determine whether it will display the rows or hide them?).
  • There's a semi exception though - RDBMS that support row-level security could do that (but effectively such system store additional attribute per row)

EDIT: Didn't remember to link http://www.sqlmaestro.com/resources/all/row_level_security_mysql/ This provides some good examples and particulars.

Possess a reviewed column within the table of type BOOLEAN. Initialize it to false, increase to true when a listing continues to be examined. If you obtain the listing of classifieds for that site include reviewed=true within the WHERE clause.

There's not a way included in phpMyAdmin.

There really is not a method to accomplish this without getting some kind of DB area that informs you which ones records you've examined and that you simply haven't.

Therefore the only sensible answer you are getting is "give a condition area".

The question is really why you won't want to get it done this way? (particularly if you already realize how to get it done). If you're able to answer that, you might get some helpful help assist with fixing the issues you see the apparent answer could cause you.

If you work with the ORM Doctrine, you should use the SoftDelete behavior, which does exactly the one thing you would like. You are able to build query's and also the "SoftDeleted" records don't return. You ought to be using Doctrine for this though.

If you can't opt for Doctrine, I'd use Piotr Pankowski's solution. The only real factor is the fact that I'd make use of a DateTime area and never an Boolean area. Set the area to the present DateTime when it is added, and NULL when it is not disabled.