Jump to content

Mark Baker

Members
  • Posts

    1,592
  • Joined

  • Last visited

    Never

About Mark Baker

  • Birthday 12/19/1960

Profile Information

  • Gender
    Male
  • Location
    Wigan, NW England

Mark Baker's Achievements

Member

Member (2/5)

0

Reputation

  1. Depends what you math is for. Simply use round or number_format to control the number of decimal place if you just want to echo the result. If these are monetary values, then it's always a lot better to hold the values as an integer number of cents/pennies rather than a float dollars/pounds: doing all of your math using integers won't give any rounding errors. Use the bc math functions, as the Warning message suggests
  2. Pay particular heed to the Warning on this page
  3. user the headers() function to set the appropriate header information to tell the browser that it's getting a csv file rather than html.... then echo out your csv content PS get rid of '<br />'. That's purely html. For a csv file you want a line feed "\n" instead
  4. Check that your SQL queries do actually return data using PHPMyAdmin or similar
  5. $rcount = $db->execute("SELECT SUM(quantity) as'' FROM items WHERE player_id = '$player->id'"); $rcount is likely to be a resource (a database result) rather than an actual integer value. You need to read your value from the result set. Why as''?
  6. You're breaking from the switch conditions, which ends the switch clause.... but your while ($row = mysql_fetch_array($result)) {echo "|" . $row['CountryName']; line is actually before the } that closes the switch, but after the breaks
  7. It's a bitwise operator, and you have to think about the data as a series of binary bits (rather than its ordinary datatype). e.g a number like 43, $a = 43; which in binary is 101011, (32 + 8 + 2 + 1) with leading zeroes giving 00000000000000000000000000101011 (to 32-bits if it's an integer on a 32-bit platform). what shift left does is shifts every bit to the left, adding a new 0 value bit as the right-most bit, and losing the existing left-most bit. If we shift left just once, we get 00000000000000000000000001010110 which is the binary value for 86 (64 + 16 + 4 + 2)
  8. How do you identify which entry needs to be next to what other entry?
  9. You can use the magic __isset method to validate whether an attribute exists or not, calling it within your magic getters/setters. PS 100 attributes is a lot, do you really need that many?
  10. <?php echo '<td><a href="product_details.php?productid='.$_POST[$productid].'">' .$productname.'</a>';?>
  11. I'd recommend the PHPExcel library listed in my sig, but you'd need to upgrade PHP on your server as well... although I'd recommend that too PHP4 really is very old now)
  12. World Wide Web Consortium (W3C) founded, Netscape Navigator 1.0 (IE 1.0 wasn't yet available) released, WebCrawler (the first web search engine)
  13. for($i=0; $i<1000; ++$i) { $formattedi = str_split(str_pad($i,4,'0',STR_PAD_LEFT)); sort($formattedi); $formattedi = implode('',$formattedi); if ($formattedi == $i) { echo $formattedi.'<br />'; } }
  14. Alternatively, why not simply use $numbers = range(1,20); shuffle($numbers) to give yourself a randomly shuffled array of numbers
×
×
  • 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.