Problem with wordpress file, query.php

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
User avatar
skynet88
Forum Commoner
Posts: 42
Joined: Tue Apr 20, 2010 5:23 pm
Contact:

Problem with wordpress file, query.php

Post by skynet88 »

i got this message when i open my website:

Parse error: syntax error, unexpected T_ELSE in /home/mrkh4nc/public_html/shortsaleforum.net/wp-includes/query.php on line 2695
and when i checked my php with PHP syntax chechk online it show '2695' is wrong:

Code: Select all

 2690: 	$content = $post->post_content;
 2691: 		if ( $page > 1 )
 2692: 			$more = 1;
 2693: 		$multipage = 1;
 2694: 		$numpages = count($pages);
 2695: 	} else {
 2696: 		$pages[0] = $post->post_content;
 2697: 		$multipage = 0;
 2698: 	}
 2699: 
 2700: 	do_action_ref_array('the_post', array(&$post));
 2701: 
 2702: 	return true;
 2703: }
 2704: 
 2705: 
 2706: ?>
anybody can help me?
Mencari Ubat Resdung? .
Make money with simcard , only for malaysian!
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Problem with wordpress file, query.php

Post by Benjamin »

Interesting, it's missing braces.
User avatar
skynet88
Forum Commoner
Posts: 42
Joined: Tue Apr 20, 2010 5:23 pm
Contact:

Re: Problem with wordpress file, query.php

Post by skynet88 »

oh ya thx for the fast feedback... can u show me the correct code? thx in advanced :D
Mencari Ubat Resdung? .
Make money with simcard , only for malaysian!
User avatar
JAY6390
Forum Newbie
Posts: 20
Joined: Sat Apr 17, 2010 6:51 am
Location: UK

Re: Problem with wordpress file, query.php

Post by JAY6390 »

You would need to post the full code for this to be sure of it but I'm thinking the if ( $page > 1 ) thats in this text is actually right (ie the curly braces aren't supposed to be there) since the next line is indented to imply it's just a one line if. If you add a { after the if ( $page > 1 ) does it fix the issue?
User avatar
skynet88
Forum Commoner
Posts: 42
Joined: Tue Apr 20, 2010 5:23 pm
Contact:

Re: Problem with wordpress file, query.php

Post by skynet88 »

this is my query.php file...

download here:

http://www.mediafire.com/file/muzrzzzurd1/query.php

someone please correct my query.php file..i really need your assist....thx in advanced.. :)
Mencari Ubat Resdung? .
Make money with simcard , only for malaysian!
User avatar
skynet88
Forum Commoner
Posts: 42
Joined: Tue Apr 20, 2010 5:23 pm
Contact:

Re: Problem with wordpress file, query.php

Post by skynet88 »

someone please help me..i cannot solve this problem yet :roll:
Mencari Ubat Resdung? .
Make money with simcard , only for malaysian!
User avatar
greyhoundcode
Forum Regular
Posts: 613
Joined: Mon Feb 11, 2008 4:22 am

Re: Problem with wordpress file, query.php

Post by greyhoundcode »

What version of Wordpress are you using? The code looks somewhat different in my query.php file.
User avatar
skynet88
Forum Commoner
Posts: 42
Joined: Tue Apr 20, 2010 5:23 pm
Contact:

Re: Problem with wordpress file, query.php

Post by skynet88 »

i use 2.9.2 version
Mencari Ubat Resdung? .
Make money with simcard , only for malaysian!
User avatar
skynet88
Forum Commoner
Posts: 42
Joined: Tue Apr 20, 2010 5:23 pm
Contact:

Re: Problem with wordpress file, query.php

Post by skynet88 »

up! up! someone please help me...i'm no idea about this prob
Mencari Ubat Resdung? .
Make money with simcard , only for malaysian!
User avatar
skynet88
Forum Commoner
Posts: 42
Joined: Tue Apr 20, 2010 5:23 pm
Contact:

Re: Problem with wordpress file, query.php

Post by skynet88 »

up! up! help me please!! :cry:
Mencari Ubat Resdung? .
Make money with simcard , only for malaysian!
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: Problem with wordpress file, query.php

Post by Jonah Bron »

Did you try putting in the curly brace ( { ) as suggested?
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Problem with wordpress file, query.php

Post by Benjamin »

Since the original author didn't use braces nor indentation correctly, it's hard to say where the missing brace is. So I guessed.

Code: Select all

function setup_postdata($post) {
    global $id, $authordata, $day, $currentmonth, $page, $pages, $multipage, $more, $numpages;

    $id = (int) $post->ID;

    $authordata = get_userdata($post->post_author);

    $day = mysql2date('d.m.y', $post->post_date, false);
    $currentmonth = mysql2date('m', $post->post_date, false);
    $numpages = 1;
    $page = get_query_var('page');
    if ( !$page )
        $page = 1;
    if ( is_single() || is_page() || is_feed() )
        $more = 1;
    $content = $post->post_content;
        if ( $page > 1 ) {
            $more = 1;
        $multipage = 1;
        $numpages = count($pages);
    } else {
        $pages[0] = $post->post_content;
        $multipage = 0;
    }

    do_action_ref_array('the_post', array(&$post));

    return true;
}
Also:
Forum Rules 1 1.1 4 wrote: 4. All users of any level are restricted from bumping (as defined here) any given thread within twenty-four (24) hours of its last post. Non-trivial posts are not considered bumping. A bump post found in violation will be deleted, and you may or may not receive a warning. Persons bumping excessively be considered as spammers and dealt with accordingly.
User avatar
skynet88
Forum Commoner
Posts: 42
Joined: Tue Apr 20, 2010 5:23 pm
Contact:

Re: Problem with wordpress file, query.php

Post by skynet88 »

thx benjamin..finally,my problem has been solved...sorry for bumping to much in this thread..

:wink:
Mencari Ubat Resdung? .
Make money with simcard , only for malaysian!
Post Reply