Welcome to Geeklog Sunday, October 24 2021 @ 02:40 pm EDT

Geeklog Forums

blog roll mod


confused

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?
 Quote

Status: offline

Dirk

Site Admin
Admin
Registered: 12/01/02
Posts: 13073
Location:Stuttgart, Germany
Get rid of the WHERE clause entirely:
PHP 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
 Quote

confused

Anonymous
determined
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?
 Quote

All times are EDT. The time is now 02:40 pm.

  • Normal Topic
  • Sticky Topic
  • Locked Topic
  • New Post
  • Sticky Topic W/ New Post
  • Locked Topic W/ New Post
  •  View Anonymous Posts
  •  Able to post
  •  Filtered HTML Allowed
  •  Censored Content