Jump to content

Recommended Posts

    function numrows($qry = $this->_tempquery)
    {
        return $qry->num_rows;
    }

 

Parse error: syntax error, unexpected T_VARIABLE in C:\apache2triad\htdocs\forum\db.class.php on line 30

 

Line 30 is the first line in the code I have shown you.  I have looked behind it and there are definitely no missing ';'.  I think the problem is setting a variable as the default parameter.. maybe it has to be $qry = "..", but I'll be really annoyed if it does, because it messes up my whole script concept.

Yeah, wildteen88's code would certainly work.  Read up on default function values in the PHP manual for any clarification you need. @_@  It would make life easier if you could just do it the way you have it though. =P

 

I don't quite understand what you mean?

The code that wildteen88 posted will do what you want.  PHP doesn't allow function defaults to be set to any variable, so you need to see if it has the default NULL value, and if it does, then set it to the "default" you want.  I was telling you to look it up in the PHP manual if you had any other questions, because there are most certainly some comments on the page that could be of use.

 

And I was also saying that life would be a bit easier if you could assign class properties to a function's default value in the function header. >_>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.