Activity Stream
48,167 MEMBERS
6878 ONLINE
besthostingforums On YouTube Subscribe to our Newsletter besthostingforums On Twitter besthostingforums On Facebook besthostingforums On facebook groups

Page 2 of 2 FirstFirst 12
Results 11 to 15 of 15
  1.     
    #11
    Member
    Website's:
    Doxsters.net
    Wow 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"

  2.   Sponsored Links

  3.     
    #12
    Member
    Website's:
    litewarez.net litewarez.com triniwarez.com
    Fetch object is simple

    think of an object as a class

    PHP Code: 
    class User
    {
        var 
    $name "Litewarez";
        var 
    $rank "Administrator";

    Then when you do Fetch object it returns the values in a class, so

    PHP Code: 
    $Object $database->fetchObject();
    $Array $database->fetchArray();

    echo 
    $Array['name'];// Litewarez
    echo $Object->name;// Litewarez 
    so the names are the database colums,

    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


  4.     
    #13
    Member
    Website's:
    Doxsters.net
    Hm, 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;

    is that fetcharray meant to be fetch Object()? because you told me to replace it?
    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"

  5.     
    #14
    Member
    Website's:
    litewarez.net litewarez.com triniwarez.com
    yea 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
        
    }

    This object can be used as a fetchObject so an example

    PHP Code: 
    $resource mysql_query("SELECT * FROM users");

    while(
    $user mysql_fetch_object($resource,"GeneralUser"))
    {
        if(
    $user->id 200)
        {
            
    $user->UpdateName("new username");
        }

    this allows us to apply "methods" as such specifically for table rows.

    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


  6.     
    #15
    Member
    Website's:
    Doxsters.net
    Ah 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"

Page 2 of 2 FirstFirst 12

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. NoFollow Class?
    By DJSquared in forum Web Development Area
    Replies: 6
    Last Post: 27th Nov 2011, 05:35 AM
  2. I need many class C IP's
    By filat in forum Hosting Discussion
    Replies: 12
    Last Post: 17th Oct 2011, 08:54 PM
  3. Should I have my class sign up here?
    By DXS in forum Polling Plaza
    Replies: 5
    Last Post: 14th Oct 2009, 04:23 AM
  4. [PHP] Threading Class
    By SplitIce in forum Tutorials and Guides
    Replies: 8
    Last Post: 1st Oct 2009, 01:24 AM

Tags for this Thread

BE SOCIAL