Posted on: 05/07/07 10:24am By: Anonymous (confused)
I was playing with dirks blogroll block and ive got it working with no problem but im wanting to do a slight mod, to the code currently the code reads
$result = DB_query ("SELECT lid,url,title FROM {$_TABLES['links']} WHERE category > '$cat'" . COM_getPermSql ('AND') . " ORDER BY $sort");
Which everything is good but i dont need the category filter i want to show all categories and just filter on new links, i tried removing it and now i get nothing it then tried
$result = DB_query ("SELECT lid,url,title FROM {$_TABLES['links']} WHERE category <=> '$cat'" . COM_getPermSql ('AND') . " ORDER BY $sort");
and i set cat to '' but again i get nothing, i thought about makeing $cat and array but then if someone where to specify other as a category then of course i would have to add it to the array for it to show. Anyone know what im missing here?
Re: blog roll mod
Posted on: 05/07/07 02:04pm By: Dirk
Get rid of the WHERE clause entirely:
Text Formatted Code
$result = DB_query ("SELECT lid,url,title FROM {$_TABLES['links']}" . COM_getPermSql ('WHERE') . " ORDER BY $sort");
Note the change in COM_getPermSql, though.
Disclaimer: Completely untested ...
bye, Dirk
Re: blog roll mod
Posted on: 05/07/07 05:11pm By: Anonymous (confused)
Well dirk you never cease to impress me ,thanks that code snippet worked , the only thing i have to do know is figure out why its sorting by date but from oldest to newest. At first i thought i had accidentally set it to random but after i added a few links i noticed the newest ones allways go to the bottom. Im trying to figure out how the variable date larget to smallest would look, any takers on that one?