Current location: Hot Scripts Forums » Programming Languages » PHP » Need a little help with RSS/PHP/MySQL


Need a little help with RSS/PHP/MySQL

Reply
  #1 (permalink)  
Old 11-15-04, 01:38 PM
gilahacker gilahacker is offline
New Member
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Need a little help with RSS/PHP/MySQL

okay, I'm running a "mambo" content management system and it has a built in script to grab articles and put them into my rss feed.

my problem is that it only grabs articles marked "frontpage" and due to the layout of my site, no articles can be marked frontpage.

this query seems to be the problem and I'm not quite sure how to fix it myself:


PHP Code:

$query "SELECT a.*, u.name AS author, u.usertype"

"\n FROM #__content AS a"
"\n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id"
"\n LEFT JOIN #__users AS u ON u.id = a.created_by"
"\n WHERE a.state = '1'"
"\n AND a.access = 0"
"\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '"$now ."' )"
"\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '"$now ."' )"
"\n ORDER BY "$orderby
. ( $info'count' ] ? "\n LIMIT "$info'count' ] : '' )

If anyone thinks they might be able to help please let me know. I can send you the entire file if you need.

Thanks.

-JL
Reply With Quote
  #2 (permalink)  
Old 11-16-04, 10:20 AM
NeverMind's Avatar
NeverMind NeverMind is offline
Community VIP
 
Join Date: Aug 2003
Location: K.S.A
Posts: 2,257
Thanks: 0
Thanked 2 Times in 1 Post
\n !!!!?
just remove these and see if it works!
I don't know why would someone put them ..

also I am not sure if MySQL will accept comparsion with quotes with one of its sides!
meaning, try to change the query to this:
PHP Code:

 $query "SELECT a.*, u.name AS author, u.usertype"

" FROM #__content AS a"
" INNER JOIN #__content_frontpage AS f ON f.content_id = a.id"
" LEFT JOIN #__users AS u ON u.id = a.created_by"
" WHERE a.state = '1'"
" AND a.access = 0"
" AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= "$now ." )"
" AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= "$now ." )"
" ORDER BY "$orderby
. ( $info['count'] ? " LIMIT "$info['count'] : '' )

I am not sure tho ..

another thing, why are using a hash in the table names? is it allowed ?
__________________
PHPSimplicity
We don't need a reason to help people - Zidane [FF9]

Last edited by NeverMind; 11-16-04 at 10:23 AM.
Reply With Quote
  #3 (permalink)  
Old 11-16-04, 06:30 PM
gilahacker gilahacker is offline
New Member
 
Join Date: Nov 2004
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks for the reply

@Nevermind:

Thanks for the response, I don't know why it's structured the way it is but that's how the people that wrote the original script put it.

I managed to figure it out with some help from my good friend Nascent:

PHP Code:

$query "SELECT a.*, u.name AS author, u.usertype"

"\n FROM #__content AS a"
//. "\n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id"
"\n LEFT JOIN #__users AS u ON u.id = a.created_by"
"\n WHERE a.state = '1'"
"\n AND a.access = 0"
"\n AND ( publish_up = '0000-00-00 00:00:00' OR publish_up <= '"$now ."' )"
"\n AND ( publish_down = '0000-00-00 00:00:00' OR publish_down >= '"$now ."' )"
//. "\n ORDER BY ". $orderby
. ( $info'count' ] ? "\n LIMIT "$info'count' ] : '' )

as you can see, it wasn't one line, but two that needed to be commented out. Now it's working.

The ORDER BY line was having issues as it's variable was calling a value from the content_frontpage table and by commenting out that line it screwed everything up...

I'm going to try and modify it so that the ORDER BY thing works again. I'll post the finished code here.
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 05:13 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.