Jump to content

phant0m

Members
  • Posts

    164
  • Joined

  • Last visited

    Never

Posts posted by phant0m

  1. assuming these "Ids" are strings, just use integers instead. This should improve the performance.

     

    and use an MySQL's index feature

     

    also, you could use a separate table for the refDomain, and use a foreign key instead. This should improve the performance as well.

  2. bascially, it is an answer to this question:

     

    Ok if theres 10 ppl and 7 say yes and 3 say no - what percentage says yes

     

    Answer : 23%

     

    But what if theres 1230 ppl and 14 say yes and 1216 say no , what percentage says yes. This is what im after

  3. what about something like this

      function get_percentage($val1, $val2, $precision=0){
        $total = $val1 + $val2;
        $result = array();
        $result[] = round($val1 / $total * 100, $precision);
        $result[] = 100 - $result[0];
        return $result;
      }

     

    get_percentage(2, 4, 2); would return an array:

    Array
    (
        [0] => 33.33
        [1] => 66.67
    )
    

  4. <?php $url=array("scheme"=>array("host"=>"www.dontmatter.com")
    ,"path"=>array("/index.php"),"query"=>array("limitstart=3")); ?>

    This is not, what parse_url returns.

     

    It returns a (one-dimensional) associative.

    "scheme" is the key, which contains the protocol(eg.g http, https), it is not an array

  5. if($counter=0)

     

    this will always evaluate to false, because:

    this is an assignment, and every assignment itself evalutaes always the value which is being assigned(0)

    Because 0 is assigned to $counter, the entire assignment represents 0, which evaluates false.

     

    To compare, you have to use ==

     

    Note: if you put the immediate first, (0 = $counter) it will result in a PHP error

     

    0 == $counter and $counter == 0 however, are equivalent

  6. It depends...

    Do you want the result to match the search string entered exactly?

    Or does the search string have to be somewhere in the result?

    This would return all results where $search is somewhere in coln

    SELECT * FROM table WHERE coln LIKE '%$search%'

     

    Make sure to escape $search properly before putting it into a query

  7. Errors shouldn't happen randomly...

    As I understand it, you were not able to reproduce the error, right?

    here's what comes to my mind:

    1) There is an unexpected, let's call it "situation" where your scripts somehow fails

    2) An attacker is involded(your login script seems prone to mysql injection)

    3) The feedback was just a hoax :P

  8. As I understand it, $AdditionalComments=nl2br($AdditionalComments); is run before the information is inserted into the database.

     

    I suggest you not to process the text in no way before inserting it into the database but rather process it, before displaying it on your homepage.

  9. <img class="avatar hasTip" src="http://******/images/avatar/thumb_38d030efce631817589108e7.jpg" title="Reece::Welcome to my Profile!<br/><hr noshade="noshade" height="1"/><img style="vertical-align:middle;padding: 0px 4px;" src="http://v3.coldcast.co.uk/components/com_community/assets/status_offline.png" />Offline | <img style="vertical-align:middle;padding: 0px 4px;" src="http://******/components/com_community/assets/default-favicon.png" />3 friends" width="45" height="45" />

    As you can see, the title attribute contains a lot of wrong info. I think something is messed up in the template.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.