Nick
VIP
v5 Beta Tester[M:5000]
Philadelphia Eagles: 8-8
Posts: 2,239
|
Post by Nick on Aug 9, 2011 18:20:16 GMT
My error is
Call to a member function duplicate() on a non-object
The function duplicate() is a function in my 'db' class that checks to see if there are any duplicate records in the database given the parameters ($field, $column, $value)
I am accessing it through my 'user' class as
$db->duplicate($field, $column, $value);
I am not sure what that error would mean. All my functions are public.
|
|
Nick
VIP
v5 Beta Tester[M:5000]
Philadelphia Eagles: 8-8
Posts: 2,239
|
Post by Nick on Aug 10, 2011 1:06:36 GMT
Nevermind, I figured it out. I just needed to redefine the $db = new db(); in my user class. I'll look into global variables
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
Post by xcessive on Aug 10, 2011 10:28:45 GMT
Or you could stop using an instance variable like a noob and make it a static class...
|
|
Nick
VIP
v5 Beta Tester[M:5000]
Philadelphia Eagles: 8-8
Posts: 2,239
|
Post by Nick on Aug 10, 2011 14:14:25 GMT
But I am a noob! xD
Making global variables fixed it. Like:
$db = new db(); global $db;
|
|
xcessive
Epic Poster
.[M:5000]
Posts: 526
|
Post by xcessive on Aug 12, 2011 7:09:02 GMT
Its still wildly inefficient and is a bad design practice. Use a static class.
|
|