e_i_pi's Profile User Rating: *****

Reputation: 823 Master
Active Posts:
1,754 (0.74 per day)
30-January 09
Profile Views:
Last Active:
User is offline Yesterday, 10:52 PM

Previous Fields

OS Preference:
Favorite Browser:
Favorite Processor:
Favorite Gaming Platform:
Your Car:
Dream Kudos:
Expert In:

Latest Visitors

Icon   e_i_pi has set their status

Posts I've Made

  1. In Topic: Attempting to add a object to an array in another class.

    Posted 29 Jun 2015

    You're clobbering the class variable with the parameter you're passing, rather than adding it as a new array element. Try this instead:
    function addStudent($student) {
        $this->registered_students[] = $student;
  2. In Topic: Find all elements/child elements that have a class (not className)

    Posted 1 Jun 2015

    For future readers / searchers who are wondering how to do this with jQuery, you use the .find() method, like so:
    var $foundClassNameElements = $('#InitialSelector').find('.foundClassName');
  3. In Topic: Fetching Multiple Rows from Table and Adding Them into Another Table

    Posted 13 May 2015

    Not to mention SQL injection. What happens when the customer name is changed to ',''),('',' in the HTML? Just because the field is hidden doesn't mean it can't be altered by someone in their browser.

    But as to your problem, on the postback, have you tried the following in your code?
    error_log(var_export($_POST, true));

    ...and then checking your error logs? You need to look at your $_POST array to see if the problem if with the data being posted back, or the way you are recursing through the data.
  4. In Topic: Why is there no boolean datatype in MySQL?

    Posted 13 May 2015

    MySQL has an aliased datatype BOOL (or BOOLEAN), which maps to TINYINT(1). I would recommend sticking with TINYINT(1), given that is the way a boolean value is traditionally stored in MySQL.
  5. In Topic: [Question] Getting 5 Most Recent Forum Posts on Home Page

    Posted 12 May 2015

    Sorry to come late to the party again. A search of the term "phpbb initialize db object" on Google reveals this phpBB wiki page on using the DBAL (database abstraction layer).

    You can avoid all this pain though, there is another way. I'm generally against using the phpBB framework to poll the phpBB database, simply because the framework is a frankenstein of a codebase - object oriented, mixed with procedural, mixed with functional. It's a nightmare to deal with in all honesty.

    Looking at that code you posted above (where you had the non-object $db issue):
    $posts_ary = array(
    	'SELECT' => 'p.*, t.*',
    	'FROM' => array(
    		POSTS_TABLE => 'p',
    	'LEFT_JOIN' => array(
    			'FROM' => array(TOPICS_TABLE => 't'),
    			'ON' => 't.topic_first_post_id = p.post_id'
    	'WHERE' => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
    					AND t.topic_status <> ' . ITEM_MOVED . '
    					AND t.topic_approved = 1',
    	'ORDER_BY' => 'p.post_id DESC',

    ...well, that steaming pile of code can be rewritten as a SQL query that doesn't even need to go through the phpBB DBAL:
    FROM phpbb_posts p
    LEFT OUTER JOIN phpbb_topics t
    	ON t.topic_first_post_id = p.post_id
    WHERE t.topic_status <> 2
    AND t.topic_approved = 1
    ORDER BY p.post_id DESC

    This will get all the columns from both the phpbb_posts and phpbb_topics tables, though you might not need all the columns. I would suggest looking in your database tables to see what columns you need, and just retrieve those columns. This SQL query can be run through your own DBA (database accessor) code, which you most likely already have. If not, you'll have to set that up, there are many tutorials around, if you start a new post in this forum I'm sure the community will be happy to help.

    You may notice in the DBAL code, these lines:
    'WHERE' => str_replace( array('WHERE ', 'forum_id'), array('', 't.forum_id'), $forum_id_where) . '
    AND t.topic_status <> ' . ITEM_MOVED . '

    ...and that I have changed them to this:
    WHERE t.topic_status <> 2

    The reason for this...
    The first line of the DBAL code simply filters by the selected forums. In your case, you want all forums, so I've removed that line. The second line of the DBAL refers to ITEM_MOVED, which is a defined constant in phpBB. It's value is 2, and is found in the file \includes\constants.php.

My Information

Member Title:
= -1
41 years old
June 24, 1974
Years Programming:
Programming Languages:
HTML, XML, jQuery, PHP, SQL, MySQL, VBA, VBScript, PostgreSQL

Contact Information

Website URL:
Website URL  http://www.artofwar.cc/


Page 1 of 1
  1. Photo

    cupidvogel Icon

    09 Jun 2012 - 11:30
    Ha ha, I really liked your "if(navigator.appName == 'Microsoft Internet Explorer')" theme!
  2. Photo

    Duckington Icon

    04 Apr 2012 - 00:57
    It's not live yet, still developing and then going into beta test. I haven't actually decided on a name yet, so no domain for it.
  3. Photo

    modi123_1 Icon

    13 Mar 2012 - 06:56
    Ha.. well good luck with it.. it's always a good butt of a joke.
  4. Photo

    RudiVisser Icon

    08 Mar 2012 - 15:20
    You know, I only just worked out what your avatar is. Love it!
  5. Photo

    RudiVisser Icon

    06 Sep 2011 - 00:37
    Thank you very much :-D
  6. Photo

    RudiVisser Icon

    06 Sep 2011 - 00:37
    Thank you very much :-D
  7. Photo

    e_i_pi Icon

    05 Sep 2011 - 22:15
    Ah thank you :) I'm a fan of minimalism, so I wwanted something nice and simple, plus you just can't go past red and black!
  8. Photo

    no2pencil Icon

    05 Sep 2011 - 19:52
    Love your avatar!
  9. Photo

    Sayid Ahmed Icon

    13 Jul 2011 - 14:02
    thanks for the add.
  10. Photo

    Dormilich Icon

    17 Feb 2011 - 13:25
    just wanted to congratulate for the funny thread title "OOP, PDOs, pain, tears".
Page 1 of 1