-
October 30th, 2010, 10:50 PM
#1
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?
-
October 31st, 2010, 07:05 AM
#2
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.
-
October 31st, 2010, 08:33 AM
#3
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|