HabboxWiki needs you!
Are you a Habbo buff? Or maybe a rare trader with a bunch of LTDs? Get involved with HabboxWiki to share your knowledge!
Join our team!
Whether you're raving for rares, excited for events or happy helping, there's something for you! Click here to apply
Need a helping hand?
Check out our guides for all things to help you make friends, make rooms, and make money!


Page 3 of 3 FirstFirst 123
Results 21 to 25 of 25
  1. #21
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    4,753
    Tokens
    1,860
    Habbo
    ,Alpha,

    Latest Awards:

    Default


  2. #22
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    @Lee; if that's anything other than a really small project can I please implore you to:

    a) Use a database abstraction layer
    b) Use the MySQLi PHP extension instead of the old MySQL one, as that has now been officially deprecated by PHP and will be removed from PHP in a few versions
    c) Use prepared statements or sprintf()
    Chippiewill.


  3. #23
    Join Date
    Oct 2006
    Location
    United Kingdom
    Posts
    4,753
    Tokens
    1,860
    Habbo
    ,Alpha,

    Latest Awards:

    Default

    Quote Originally Posted by Chippiewill View Post
    @Lee; if that's anything other than a really small project can I please implore you to:

    a) Use a database abstraction layer
    b) Use the MySQLi PHP extension instead of the old MySQL one, as that has now been officially deprecated by PHP and will be removed from PHP in a few versions
    c) Use prepared statements or sprintf()
    Its not anything that will leave the comfort of localhost, but still improvements are always really useful so...

    a) Elaborate please?

    b) so literally type i at the end and thats it so mysqli_query or mysqli_fetch_assoc?

    c) difference between print_r and sprint_f?

  4. #24
    Join Date
    May 2007
    Posts
    10,481
    Tokens
    3,140

    Latest Awards:

    Default

    a) A database abstraction layer essentially handles a lot of the work for you, for instance instead of saying mysql_query(); you'd have a set of functions or an object that do all the various bits. E.g. $db->insert( <table name>, <array of stuff> ) and it'll insert everything in to the table and escape all the data for you. You can find some for free on the internet that are fairly good.

    b) Pretty much but there are some changes on the original functions. Ideally you should use the object oriented version as it's a bit tidier.

    c) print_r prints an array. sprintf is an efficient way of concentating a string (e.g. something like $foo = 'some bit of string' . $bar . 'some more string';), you can say $foo = sprintf( "SELECT * FROM table WHERE column = '%s' AND othercolumn = %d", $string, $integer ); and it'll insert the contents of $string where %s is and the contents of $integer where %d, importantly it enforces type, so only a string can be inserted where a %s is and only a number where a %d is.
    Chippiewill.


  5. #25
    Join Date
    Dec 2008
    Location
    South Wales
    Posts
    8,911
    Tokens
    7,620
    Habbo
    J25T

    Latest Awards:

    Default


Page 3 of 3 FirstFirst 123

Posting Permissions

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