Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7826607
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T09:29:36+00:00 2026-06-02T09:29:36+00:00

I have got this function that returns a constant..Here is my class and function:

  • 0

I have got this function that returns a constant..Here is my class and function:

class Backlinks extends GoogleSearch {
const ROBOTS_NOINDEX_NOFOLLOW = 606;

    function robotsNoIndexNoFollow(){
    $crawler = new Connection();
    $curl = $crawler -> setUrl($this->url) ->getDocument();
    if ($curl){
        $html = new simple_html_dom($curl);
        $robots = $html -> find("meta[name=robots]", 0);
        $html -> clear();
        unset ($crawler);
        if ($robots){
            $content = $robots -> getAttribute("content");
            $content = strtolower($content);
            if (substr_count($content, "noindex")){
                return ROBOTS_NOINDEX_NOFOLLOW; 
            }
            if (substr_count($content, "nofollow")){
                return ROBOTS_NOINDEX_NOFOLLOW;
            }
        }
        else{
            return false;
        }
    }

}

The problem above is in the ROBOTS_NOINDEX_NOFOLLOW contatnt.
The constant goes into another function as an error parameter to be updated in the database.

public function setStatus($error){
    $status = $error;
    if (!$error){
        $status = 200;
    }
    // only update the pages which weren't already scanned (for historic purposes).
    $query = "UPDATE task_pages tp 
        SET scan_status = $status 
        WHERE page_id = $this->pageID AND scan_status = 0";
    mysql_query($query) or die(mysql_error());
}

I get two errors:

Notice: Use of undefined constant ROBOTS_NOINDEX_NOFOLLOW – assumed
‘ROBOTS_NOINDEX_NOFOLLOW’ in C:\Program Files
(x86)\Zend\Apache2\htdocs\backlinks\cron\Backlinks.php on line 78
Unknown column ‘ROBOTS_NOINDEX_NOFOLLOW’ in ‘field list’

One is the problem with the constant not being defined..which I dont understand why.
The second problem is with the sql..which interprets the constant as a column?!?

Why and how to correct that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T09:29:44+00:00Added an answer on June 2, 2026 at 9:29 am

    You need to use ‘self’ to reference the constant:

    return self::ROBOTS_NOINDEX_NOFOLLOW

    Otherwise, PHP would try to find the constant in the global scope even though in your case this is a class constant.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Code is not running on .click when I have this: $(.cancel).click(function() { alert(got here);
Say I have a function that returns an array like this... array( 0 =>
I have a class and in that class there is a function that returns
I have got code like this var challegneListener; $(document).ready(function(){ var challegneListener = setInterval(challengeListenerBot(),5000); });
I have got this html: <div id=myDiv> <p class=readMore></p> <p class=readMore></p> <p class=readMore></p> </div>
I have got an XSLT that looks like this: <xsl:stylesheet version=1.0 xmlns:xsl=http://www.w3.org/1999/XSL/Transform> <xsl:output method=xml
I have this function that creates a unique number for hard-disk and CPU combination.
I have a function that returns a DataTable DataTable dt = GetAllObject(ogj_id); Now I
I have a piece of C code that looks like this: const char (*foo)[2]
I have PL/SQL function that returns cursor that holds 28 columns and 8100 rows.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.