Jump to content

[SOLVED] Conditions within MYSQL Query


SchweppesAle

Recommended Posts

Hi, just having a little trouble with nested MySQL conditions

 

the following will query all entries within a set category defined by the ID

 

$query = "SELECT * FROM #__content WHERE (catid = '$cat1')";

 

which is great, however since this is a joomla database I wanted to make the application I'm designing won't pull content which has been unpublished so I tried expanding my condition to the following.

 

 

$query = "SELECT * FROM #__content WHERE (catid = '$cat1' & publish_down < publish_up)";

Unfortunately, this seems to pull in all published content from every category.  What would be the appropriate way of doing this?

Link to comment
https://forums.phpfreaks.com/topic/151932-solved-conditions-within-mysql-query/
Share on other sites

hmmm...that was simple enough.  It looks like it worked, but I think I mistook what the publish_down column was intended for(scheduling when to unpublish).  Does anyone know how Joomla 1.5 differentiates between published/unpublished articles? 

hmmm...that was simple enough.  It looks like it worked, but I think I mistook what the publish_down column was intended for(scheduling when to unpublish).  Does anyone know how Joomla 1.5 differentiates between published/unpublished articles? 

 

Not sure, but you can find an unpublished and a published article and look in the database between what the differences are.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.