Results 11 to 15 of 15
-
23rd Jul 2010, 02:24 PM #11OPMemberWebsite's:
Doxsters.netWow thats really complicated, maybe I'll get it once I do a bit more PHP, I've only been doing it for a week now
Also I didnt particularly get the fetchObject thing, are there any links to explain it? I havent encountered the as keyword before.
Also yeah, I noticed that I was escaping the whole string :\
Luckily I realised and split it into different functions
Anyway, thanks for taking the time to post such a lengthy reply
Need a Designer/Web Developer? Click Me
MSN: PM me for it.
Email(Preferred):timtamboy63@gmail.com
"Power Corrupts. Absolute Power Corrupts Absolutely"
-
23rd Jul 2010, 02:35 PM #12MemberWebsite's:
litewarez.net litewarez.com triniwarez.comFetch object is simple
think of an object as a class
PHP Code:class User
{
var $name = "Litewarez";
var $rank = "Administrator";
}
PHP Code:$Object = $database->fetchObject();
$Array = $database->fetchArray();
echo $Array['name'];// Litewarez
echo $Object->name;// Litewarez
so if i had a db table users with 3 columns (id,name,pass) i can use $Object->pass for example.
Heres some more examples that isn't really DB related
PHP Code:$Object = new stdClass(); //Blank class that can be used like an array
//Slandered variables
$Object->IAmTheChosenOne = true;
$Object->MyFatherIsABasterd = false;
$Object->MyMotherSucksYouKNowWhat = "?";
//Inner Array
$Object->array = array("hello" => "helloValue");
$Object->array['hello'];
//Inner Object
$Object->AnotherObject = new StdClass();
$Object->AnotherObject->key = "value";
Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
24th Jul 2010, 01:14 AM #13OPMemberWebsite's:
Doxsters.netHm, I think I get it, but I don't really get the advantage it has over fetch_array?
Also when you said so i can do:
PHP Code:
foreach($phonebook->fetchArray() as $Object)
{
echo $Object->ColumnName;
}
Anyway, I will be doing some more research into it, thanks
Need a Designer/Web Developer? Click Me
MSN: PM me for it.
Email(Preferred):timtamboy63@gmail.com
"Power Corrupts. Absolute Power Corrupts Absolutely"
-
24th Jul 2010, 01:48 PM #14MemberWebsite's:
litewarez.net litewarez.com triniwarez.comyea FetchObject();
the advantage is the style of coding, you become naturally to Object Using adn help you grow with OOP.
also take this idea:
Lets say i have a table called users with the columns (id,username,password,hash,reg_date)
and i created a class called GeneralUser
PHP Code:class GeneralUser
{
var $id;
var $username;
var $password;
var $hash;
var $regdate;
public function UpdateName($new_username)
{
//Run Query To Update Id
}
}
PHP Code:$resource = mysql_query("SELECT * FROM users");
while($user = mysql_fetch_object($resource,"GeneralUser"))
{
if($user->id > 200)
{
$user->UpdateName("new username");
}
}
Most programmers would normally code a username update block a few times but by created an OOP version you only have to code it once and use it when needed, this is what OOP is about, creating code that can be used over and over again in multiple formats as such.Join Litewarez.net today and become apart of the community.
Unique | Clean | Advanced (All with you in mind)
Downloads | Webmasters
Notifications,Forum,Chat,Community all at Litewarez Webmasters
-
24th Jul 2010, 03:11 PM #15OPMemberWebsite's:
Doxsters.netAh I see, thanks
Need a Designer/Web Developer? Click Me
MSN: PM me for it.
Email(Preferred):timtamboy63@gmail.com
"Power Corrupts. Absolute Power Corrupts Absolutely"
Sponsored Links
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
NoFollow Class?
By DJSquared in forum Web Development AreaReplies: 6Last Post: 27th Nov 2011, 05:35 AM -
I need many class C IP's
By filat in forum Hosting DiscussionReplies: 12Last Post: 17th Oct 2011, 08:54 PM -
Should I have my class sign up here?
By DXS in forum Polling PlazaReplies: 5Last Post: 14th Oct 2009, 04:23 AM -
[PHP] Threading Class
By SplitIce in forum Tutorials and GuidesReplies: 8Last Post: 1st Oct 2009, 01:24 AM
themaLeecher - leech and manage...
Version 5.03 released. Open older version (or...