1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

what do you think of my way coding? (

Discussion in 'PHP' started by x0x, Mar 12, 2010.

  1. #1
    Instead of a field names like: time, lastseen, current page etc I use numbers like 1,2,3. And instead of the info in fields I use 1 or 0 instead of 'yes' or 'no, or 'on and 'off'. What do you think? I think this would really boost the performance.
    SEMrush
     
    x0x, Mar 12, 2010 IP
    SEMrush
  2. plog

    plog Peon

    Messages:
    298
    Likes Received:
    11
    Best Answers:
    1
    Trophy Points:
    0
    #2
    I think you are trolling.
     
    plog, Mar 12, 2010 IP
  3. danx10

    danx10 Peon

    Messages:
    1,179
    Likes Received:
    44
    Best Answers:
    2
    Trophy Points:
    0
    #3
    Heres my view; based on if another person views your code...

    I disagree, and would'nt do this, simply because databases can become large, and numbering columns can make it confusing. Theirfore it would be best to just leave them with names, as it would be easier to recognise and understand.

    However, I agree on this, as this would make no effect on anyone who has php knowledge to understand (since its just how boolean works).
     
    danx10, Mar 12, 2010 IP
  4. noface83

    noface83 Peon

    Messages:
    8
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It's look like enumeration, I prefer to save the name of enumeration rather than the value. It's will make you confuse to know the name from database.
     
    noface83, Mar 16, 2010 IP
  5. Pudge1

    Pudge1 Well-Known Member

    Messages:
    912
    Likes Received:
    6
    Best Answers:
    1
    Trophy Points:
    140
    Digital Goods:
    1
    #5
    It can make things very confusing, it would make it easier just to use names. But if you can understand it go right ahead.
     
    Pudge1, Mar 16, 2010 IP
  6. !Unreal

    !Unreal Well-Known Member

    Messages:
    1,671
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    165
    #6
    That would get confusing with column names and theres no obvious advantages with performance. But using 0 and 1 makes sense, boolean.
     
    !Unreal, Mar 16, 2010 IP
  7. Grit.

    Grit. Well-Known Member

    Messages:
    1,424
    Likes Received:
    22
    Best Answers:
    1
    Trophy Points:
    110
    #7
    It's ok for a small script, but if you then go onto a large project, if you're memory isn't excellent, then you'll find you have to keep referencing to see what equals what, and it can get confusing :S
     
    Grit., Mar 16, 2010 IP
  8. shallowink

    shallowink Well-Known Member

    Messages:
    1,218
    Likes Received:
    64
    Best Answers:
    2
    Trophy Points:
    150
    #8
    agree on the memorization aspect with Grit. guess you could set your coding up so you use the same basic format using your system but it seems to me to be unnecessarily confusing.
     
    shallowink, Mar 16, 2010 IP