Jump to content

zq29

Staff Alumni
  • Posts

    2,752
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by zq29

  1. Nicholas16, I think you would benefit from learning the basics of the language before jumping into things.

     

    Two forward slashes denote the start of a comment, and does not get processed by the PHP interpreter. You can leave notes throughout your code using this concept.

  2. No, it means 207 lines down. If that is actually the contents of your whole file I guess it is taking the lines inside your included globals.php file into consideration too.

     

    The error you are experiencing is being caused by this:

    print "<h3>General Information:</h2>";

    Change it to this:

    print "<h3>General Information:</h3>

     

    I have removed the double quote and semi-colon that terminate the line. I have also fixed an error in your HTML.

  3. Sure thing. Same code again, but with comments explaining.

     

    <?php
    //Create an array in preparation for storing the groups of origins and counts
    $x = array();
    //Fetch all origins and their counts
    $r = mysql_query("SELECT `lp_origin`,COUNT(*) as `count` FROM `lps` GROUP BY `lp_origin`") or die(mysql_error());
    //Loop through the query results, storing them in our previously created array, the origin name as the key the count as the value
    while($rr = mysql_fetch_assoc($r)) $x[$rr['lp_origin']] = $rr['count'];
    //Calculate the total of all origins, this is why we converted the SQL results to an array ($x)
    $t = array_sum($x);
    //Loop through our previously created array and display the origins (array key ($k)) and their percentage calculated from the count (array value ($v)) and sum ($t)
    foreach($x as $k => $v) echo "$k: ".(($v/$t)*100)."%<br />";
    ?>

  4. nope i cant figure it out, i dont know what it means by "on line 207" what does it mean?

    It means the error is on, or close to, line 207 of your code.

     

    The error can be resolved by reviewing line 4 of the code that you have posted, though.

  5. Well, expanding on my previous example, you could do this:

    <?php
    $x = array();
    $r = mysql_query("SELECT `lp_origin`,COUNT(*) as `count` FROM `lps` GROUP BY `lp_origin`") or die(mysql_error());
    while($rr = mysql_fetch_assoc($r)) $x[$rr['lp_origin']] = $rr['count'];
    $t = array_sum($x);
    foreach($x as $k => $v) echo "$k: ".(($v/$t)*100)."%<br />";
    ?>

  6. Without seeing your full database schema, you could reduce it to at least two queries, and a reduction in PHP, like so:

     

    <?php
    $r = mysql_query("SELECT `lp_origin`,COUNT(*) as `count` FROM `lps` GROUP BY `lp_origin`") or die(mysql_error());
    while($rr = mysql_fetch_assoc($r)) echo "$rr[lp_origin]: $rr[count]<br />";
    
    $members = 0;
    $r = mysql_query("SELECT `member_gender`,COUNT(*) as `count` FROM `members` GROUP BY `member_gender`") or die(mysql_error());
    while($rr = mysql_fetch_assoc($r)) {
        echo "$rr[member_gender]: $rr[count]<br />";
        $members += $rr['count'];
    }
    echo "Total members: $members";
    ?>

     

    9three, your query wouldn't return anything - `member_gender` can't be both 'm' and 'f'.

  7. That gives me an idea...I wonder how much I can get away with for writing a condition that checks browser version and redirecting user to ms ie8 dl page if it's <= ie6? :P

    I do something similar with my projects, by displaying a message notifying the user that they're using an old and out-dated browser with links to Firefox 3.x, Chrome, Opera, Safari and IE8.

  8. Too late, I bid $10mil!

    Bloody foreigners, always doing it cheaper than I can afford to. This is why our industry is so under-valued, it makes me sick.

     

    Last I checked, you're in England while CV and The White House are in the US :P

    Minor details...

  9. I've never understood the hype around netbooks.  Woo!  A small laptop that's pretty much only good for the internet!  Do people who can't afford full sized laptops buy them, or are there really people out there that are only interested in email/youtube/facebook/etc?

     

    I have a netbook, the Asus Eee PC 901 to be exact. I have two MacBooks too. So yes, people who have actual laptops buy them as well.

     

    I take mine to meetings where I only need to take notes, or record audio. Takes less space, doesn't get as hot and noisy, and the battery lasts longer than my MacBooks. I have the Ubuntu Netbook Remix OS installed on it. Good for messing around on while taking a shit too.

  10. You can count up to 999,999,999 with the sounds that are included with Asterisk, but they are in separate files, so for that example you would have to chain the files in the following order:

    • 9.wav
    • hundred.wav
    • and.wav
    • 90.wav
    • 9.wav
    • million.wav
    • 9.wav
    • hundred.wav
    • and.wav
    • 90.wav
    • 9.wav
    • thousand.wav
    • 9.wav
    • hundred.wav
    • and.wav
    • 90.wav
    • 9.wav

     

    Although, if you wanted every number in a file, you could write a quick script to build them from the single files.

  11. I'll probably lose the spec wars:

     

    Intel P4 2.24 GHZ.

    80 GB HD.

    1 GB DDR2 RAM.

    9200 LE ATI

    Some asus motherboard.

     

    I remember when I bought this computer and P4s were considered awesome at the time.

     

    that was ages ago lol, i rember when hyper threading was considdered awsome or even dual core

     

    My main machine at home is only a P4 2.4GHz - I only ever use it for web development and playing CounterStrike: Source. Don't need anything faster than that for what I use it for. All other games I play on the 360, PS3 or Wii.

  12. Errrr....  Pretty sure grep exists on Windows, although I don't think locate does.  Or were you kidding when you said solely for those 2 features? ;p

     

    There is a version of grep that can be installed on Windows, but it doesn't come pre-installed.

     

    EDIT: Turns out Windows comes with a utility called findstr that functions similarly to grep.

  13. I might as well play along... This is my main dev machine in the office - I don't have the patience to list the specs of all my boxes.

     

    • Intel Core i7 920 D0
    • Gigabyte EX58-UD3R
    • G.Skill NQ 6GB DDR3 (3x2GB)
    • Hiper 4M880
    • 2 x 64GB Samsung SSD (RAID 0), 1 x 1TB Samsung SATA HDD
    • GeForce 7300 LE
    • GeForce 5200
    • Matrox G450 X4 MMS
    • 3 x 17" TFT
    • Ubuntu 9.04 (64 bit)

×
×
  • 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.