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

Reputation: 802 Master
Group:
Mentors
Active Posts:
1,717 (0.77 per day)
Joined:
30-January 09
Profile Views:
50,390
Last Active:
User is offline Yesterday, 09:53 PM
Currently:
Offline

Previous Fields

Country:
AU
OS Preference:
Windows
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
Playstation
Your Car:
Mitsubishi
Dream Kudos:
75
Expert In:
Databases

Latest Visitors

Icon   e_i_pi has set their status

Posts I've Made

  1. In Topic: Should I be using OOP?

    Posted 1 Mar 2015

    View Postbaavgai, on 01 March 2015 - 10:35 PM, said:

    If you're using PDO, you using OOP...

    Some PHP gurus might get mad at me, but I generally find OOP in PHP to be like a fish on a unicycle; rather absurd and sad.

    RAR, MAKE ME ANGRY!

    But yes, I agree, OOP in PHP is a bit jumbled. The introduction of typehinting and namespacing has done a lot to make OOP more useful in PHP, but I think the big improvement will be if/when return type declarations are implemented. Overloading will still be missing, but I'm still not sold on overloading being a particularly good feature of OOP, especially given some of the implementations I've seen.
  2. In Topic: My insert to sql not inserting properly

    Posted 16 Feb 2015

    The context of LAST_INSERT_ID() is the last insert into the database, no matter what the table. Let's step through the code, and see what would happen when we enter 3 walls:

    Line 4 - INSERT into customer, custID will be 1
    Line 8 - INSERT into quote, LAST_INSERT_ID() picks up value of 1 from table 'customer'
    Line 16 (1st iteration) - INSERT into wall, LAST_INSERT_ID() picks up value of 1 from table 'quote'
    Line 16 (2nd iteration) - INSERT into wall, LAST_INSERT_ID() picks up value of 1 from table 'wall'
    Line 16 (3rd iteration) - INSERT into wall, LAST_INSERT_ID() picks up value of 2 from table 'wall'

    The issue here is your assumption that LAST_INSERT_ID() is picking up the value you want (quoteId) when in fact it's just picking up the last insert ID.

    The remedy is to add a SELECT statement after line 10 to select the LAST_INSERT_ID(), and then assign that value to a PHP variable. You can then use that variable in the INSERT statement on line 16. It would also be good practice to add a similar SELECT statement after line 6, to use in the INSERT statement on line 8.
  3. In Topic: white page : unexpected '{', expecting '('

    Posted 15 Feb 2015

    As andrewsw said, yes it happens to all of us, and the more complex the application the more prone you are to it happening. Along with andrewsw's suggestions, you can also tighten up your error logging on your system by halting on all errors. This will catch such things as referencing a variable that isn't instantiated, which happens when you make typos for instance. You can turn on extremely strict error logging like so:

    PHP 5.4+
    ini_set('error_reporting', E_ALL);
    error_reporting(E_ALL);
    
    


    PHP <5.4
    ini_set('error_reporting', E_ALL | E_STRICT);
    error_reporting(E_ALL | E_STRICT);
    
    
  4. In Topic: why my page is redirected to wrong page

    Posted 15 Feb 2015

    It means that the only time your else statement is reached is when $_POST['login'] is an empty string. You're not actually validating the login credentials at all (i.e. the login/password combination)
  5. In Topic: incrementing numbers for unique id jquery

    Posted 27 Jan 2015

    I use a custom function I created:
    function generateUniqueID()
    {
        var randomID = Math.random().toString(36).substr(2,16);
        if($('#' + randomID).length > 0)
        {
            return generateUniqueID();
        } else {
            return randomID;
        }
    }
    
    

My Information

Member Title:
= -1
Age:
40 years old
Birthday:
June 24, 1974
Gender:
Location:
Australia
Years Programming:
4
Programming Languages:
HTML, XML, jQuery, PHP, SQL, MySQL, VBA, VBScript, PostgreSQL

Contact Information

E-mail:
Private
Website URL:
Website URL  http://www.artofwar.cc/

Comments

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