php error, plz help
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: php error, plz help

  1. #1
    Join Date
    Oct 2010
    Posts
    2

    php error, plz help

    Hello all,
    i am new to php and need help with my code.

    Code:
    <?php
        class vars{
            function get($filed_name){
                $data = $_GET[$filed_name];
                if(!$data) return 0;
                return $data;
            }
        }
    ?>
    
    <?php
    $clss = new vars();
    header('Content-Type: text/html; charset=utf-8');  
    define("BaseSite", "http://localhost:3000/");
    ?>
    
    <?php
        if (!$_GET['edit'] & !$_GET['id']) {
    ?>
    
    <html>
    .....
    </html>
    
    <?php } else {
            if($_GET['edit'] == 1 & $_GET['id'] > 0){
                $ID = $vars->get("id");
                $update = 1;
    ?>
    <html>
    ......
    </html>
    
    <?php
        }
    ?>
    when the BOLD line is calling i get an error:
    "php call to a member function get() on a non-object......"

    someone can help me please?

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,860

    Re: php error, plz help

    Please remember to search before posting. This is the most common PHP error. It means you're using a function off an object type variable.

    PHP Code:
    $ID $vars->get("id"); 
    No where in that script did you create $vars so naturally it cannot be an object.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

  3. #3
    Join Date
    Oct 2010
    Posts
    2

    Smile Re: php error, plz help

    thank you very much.
    i dont know how i didnt notice.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center