PHP 4 compatible switchover (Help Needed)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jon

    PHP 4 compatible switchover (Help Needed)

    function fetch_row($quer y, $autoclose = true)
    {
    if(is_string($q uery))
    $query = self::query($qu ery, true);
    $return = mysql_fetch_row ($query);
    if($autoclose)
    self::close($qu ery);
    return $return;
    }

    In PHP4 i get an error stating that the $query= self::query line
    contains an "Undefined class name 'self'"

    how, in general, can I take this and make it php4 compatible?$que ry is
    defined as

    function query($query, $return = false)
    {
    $fetch = mysql_query($qu ery, $this->connection) or
    die2(mysql_erro r($this->connection)) ;
    if($return)
    return $fetch;

    Any help would be appreciated...

    Jon

  • Janwillem Borleffs

    #2
    Re: PHP 4 compatible switchover (Help Needed)

    Jon wrote:[color=blue]
    > In PHP4 i get an error stating that the $query= self::query line
    > contains an "Undefined class name 'self'"
    >
    > how, in general, can I take this and make it php4 compatible?>[/color]

    When the class is instantiated, simply replace "self::" with "$this->"; when
    used statically, replace it with "ClassName: :".


    JW



    Comment

    • Jon

      #3
      Re: PHP 4 compatible switchover (Help Needed)

      On 2006-01-22 16:10:43 -0600, "Janwillem Borleffs" <jw@jwscripts.c om> said:
      [color=blue]
      > Jon wrote:[color=green]
      >> In PHP4 i get an error stating that the $query= self::query line
      >> contains an "Undefined class name 'self'"
      >>
      >> how, in general, can I take this and make it php4 compatible?>[/color]
      >
      > When the class is instantiated, simply replace "self::" with "$this->";
      > when used statically, replace it with "ClassName: :".
      >
      >
      > JW[/color]

      Thanks for your post, I think this will be immesly helpful. Now, one
      last question to set me straight. How can I tell when a class is
      instantiated vs. statically?

      Thanks a bunch!
      jon

      Comment

      • Janwillem Borleffs

        #4
        Re: PHP 4 compatible switchover (Help Needed)

        Jon wrote:[color=blue]
        > Thanks for your post, I think this will be immesly helpful. Now, one
        > last question to set me straight. How can I tell when a class is
        > instantiated vs. statically?
        >[/color]

        By the way it's called:

        Instantiated: $class->method();
        Statically: ClassName::meth od();


        JW


        Comment

        Working...