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.

Let's create framework !!!

Discussion in 'PHP' started by genetrix, Jul 12, 2008.

  1. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #21
    ^ My thoughts exactly.

    This function will never return true... and why on earth are you still using quotes around the variables? Even if this is just for learning purposes, at least "teach" people right.

    
    function mysqlQuiery($sql){
      $query = mysql_query($sql) or die(mysql_error());
      return $query;
      }
    
    PHP:
    mysqlQuiery? Come on... you're not even trying, are you? I first thought this was a typo, but the description says it too, lol. Ah well...


    The whole class you posted there is the most pointless piece of code I've ever seen.

    You should also write your class in PHP 5.. and not 4 (PHP 4 officially died more than a half year ago). And improve the error handling...


    ... WTF? Lol... why don't you just add a space to the expression rather than exploding the string and checking each chunk? And what if there was a 5000 word text... you'd run 5000 regular expressions? Wow... Even if you wanted to use your method, how about doing it this way:
    
    if(!ereg("^[_A-Za-z0-9/\]+$", $val)){
        return false
    }
    
    PHP:
    ... there could be an invalid chunk right at the beginning, and you'd still run regular expressions for all the other ones (unnecessarily, of course...)

    .... whhhaaaaat?! This is one of the most confusing and worst structured parts of the whole code. If the first expression matches but the second doesn't, it returns null. And I really fail to see what any of this has to do with URLs? Regular expression to see if there's a space in the string?

    ... so %%%%%@%%%%.com is a valid email address? And these millions of dirty if/else statements. Do it just this way:
    
    function foo($bar)
    {
        return preg_match('~[regex]~', $bar);
    }
    
    PHP:
    Use PREG_MATCH instead of eregi()... the ereg_* functions are about 6 times SLOWER than the preg_* functions.


    I hope no one actually plans on using this, errr.... "framework".

    IF you really want to reinvent the wheel, at least do it right. No one wants this crap.
     
    nico_swd, Jul 29, 2008 IP
  2. genetrix

    genetrix Banned

    Messages:
    400
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #22
    What is it ? hm ?
     
    genetrix, Jul 29, 2008 IP
  3. genetrix

    genetrix Banned

    Messages:
    400
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #23

    THANK YOU MUCH !! I'VE REPAIRED ERRORS , SO LETS CONTINUE .
     
    genetrix, Jul 29, 2008 IP
  4. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #24
    Okay, I don't know how to put it so you actually understand... I wasn't trying to help improving it, but pointing out how crappy and pointless the whole thing is.

    Let's face it:
    - No one is interested in this "framework".
    - Your level of programming and experience isn't high enough to create a useful application like this.
    - No one is gonna help you, because it's pointless and a waste of time. We (or "the others") would have to spend a great amount of time just fixing the code YOU'VE previously provided.

    In other words, YOU'RE ALONE!
     
    nico_swd, Jul 29, 2008 IP
    rohan_shenoy likes this.