Page 1 of 1

Logic-shreddingly impossible problems

Posted: Sat Feb 21, 2009 1:03 pm
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:

Re: Logic-shreddingly impossible problems

Posted: Sat Feb 21, 2009 1:19 pm
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.

Re: Logic-shreddingly impossible problems

Posted: Sat Feb 21, 2009 6:42 pm
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!

Re: Logic-shreddingly impossible problems

Posted: Sun Feb 22, 2009 6:09 am
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.

Re: Logic-shreddingly impossible problems

Posted: Sun Feb 22, 2009 6:19 am
by semlar
Start commenting out lines until it works.