Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
php error, please help
Old 10-30-2010, 10:23 PM php error, please help
Junior Talker

Posts: 2
Name: Roey
Trades: 0
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?
roeyhaim is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 10-31-2010, 04:13 AM Re: php error, please help
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
I don't see $vars being set in that code. Should it be:
PHP Code:
$ID $clss->get('id'); 
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Old 10-31-2010, 09:32 AM Re: php error, please help
Junior Talker

Posts: 2
Name: Roey
Trades: 0
thank you very much.
i dont know how i didnt notice.
roeyhaim is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to php error, please help
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12029 seconds with 12 queries