Logic-shreddingly impossible problems

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
wogan
Forum Newbie
Posts: 2
Joined: Sat Feb 21, 2009 12:56 pm

Logic-shreddingly impossible problems

Post by wogan »

At least, that's what my PHP is returning. This is the code I'm trying to execute:

Code: Select all

<?php
 
// Connect to DB
define('IN_SFR', 'YES');
include('dbconnect.php');
 
// Check for time since last run?
// No, we'll use MagpieRSS's builtin cache function instead
 
// We'll need this to parse feeds
require_once('magpierss/rss_fetch.inc'); // Magpie
// require_once('sanitize.inc');
 
$feeds = mysql_query("SELECT * FROM `feeds` WHERE `active` = '1'");
 
while ( $feed = mysql_fetch_assoc($feeds) )
{
 
    $feed_url = $feed['feed_url'];
    $rss = fetch_rss();
 
    // Items FOREACH
    foreach ($rss->items as $item) {
        
        // Which feed is this coming from?
        $todb_feedid = $feed['feedid'];
 
And that while() goes on for a while(). Both the require_once's are files I've used before, and I've used a while() loop with mysql_fetch_assoc. $feeds is returning a valid MySQL Resource, which mysql_fetch_assoc is reading correctly.

But this is the error when I try running that code:
Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `'{'' or `'$'' in C:\wamp\www\arcane.co.za\SFR\feedfetcher.php on line 21
Do you see the kicker? Line 21 is the blank space after fetch_rss();

I've tried commenting out everything at the top, I've tried adding in numerous strings and variables and { and $ just to get a different error message, but it keeps coming back to that error.

Am I making some horrible mistake I'm not seeing? Because I'm really up against the wall here :banghead:
itp
Forum Commoner
Posts: 67
Joined: Fri Jun 15, 2007 6:50 am

Re: Logic-shreddingly impossible problems

Post by itp »

Does not make sense.
Are you sure that you are running against the correct line.
Try adding some blanks line & see if line with error changes.
User avatar
califdon
Jack of Zircons
Posts: 4484
Joined: Thu Nov 09, 2006 8:30 pm
Location: California, USA

Re: Logic-shreddingly impossible problems

Post by califdon »

Remember that by the time the parser encounters the error, it has already loaded the include file, so the line number will be much higher than your script shows it!
wogan
Forum Newbie
Posts: 2
Joined: Sat Feb 21, 2009 12:56 pm

Re: Logic-shreddingly impossible problems

Post by wogan »

By adding blanks, the line number with the error does change. And no, including a file won't mess up the line number - according to the error message, it's line 21 in that specific file. Commenting out the includes also changes nothing.
semlar
Forum Commoner
Posts: 61
Joined: Fri Feb 20, 2009 10:45 pm

Re: Logic-shreddingly impossible problems

Post by semlar »

Start commenting out lines until it works.
Post Reply