Welcome to Geeklog, Anonymous Friday, November 08 2024 @ 09:01 pm EST

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: 01/12/02
Posts: 13073
Location:Stuttgart, Germany
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
 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 EST. The time is now 09:01 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