Mark Baker
Members-
Posts
1,592 -
Joined
-
Last visited
Never
Everything posted by Mark Baker
-
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
-
Pay particular heed to the Warning on this page
-
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
-
Check that your SQL queries do actually return data using PHPMyAdmin or similar
-
$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''?
-
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
-
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)
-
Need help: how to catch acess of undefined class properties
Mark Baker replied to baman's topic in PHP Coding Help
So what's line 30? -
Select from db Order by name (but with one exception)
Mark Baker replied to deansatch's topic in MySQL Help
How do you identify which entry needs to be next to what other entry? -
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?
-
[SOLVED] Whats wrong with this line of code.
Mark Baker replied to deansaddigh's topic in PHP Coding Help
<?php echo '<td><a href="product_details.php?productid='.$_POST[$productid].'">' .$productname.'</a>';?> -
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)
-
PREVENTING Piracy of web based applications
Mark Baker replied to canadabeeau's topic in Miscellaneous
World Wide Web Consortium (W3C) founded, Netscape Navigator 1.0 (IE 1.0 wasn't yet available) released, WebCrawler (the first web search engine) -
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 />'; } }
-
Fatal error: Maximum execution time of 30 seconds exceeded
Mark Baker replied to jlryan87's topic in PHP Coding Help
Alternatively, why not simply use $numbers = range(1,20); shuffle($numbers) to give yourself a randomly shuffled array of numbers -
I'm not familiar with the psxlsgen class, and I'd recommend you switch to use a library that is still actively supported. However, I'm intrigued by this line: $this->WriteText_pos( $this->crow, $this->ccol, &$value ); What version of PHP are you using? Or is the psxlsgen class using? because passing by reference in this manner is deprecated.
-
PREVENTING Piracy of web based applications
Mark Baker replied to canadabeeau's topic in Miscellaneous
Running the application on your own servers as a managed service is also an option you might consider -
PREVENTING Piracy of web based applications
Mark Baker replied to canadabeeau's topic in Miscellaneous
Zend Guard -
Within the funWrite() function, $a isn't defined when you compare it against the string "QUIT;", so it is not equal and your comparison is always true... therefore it displays the syntax error message
-
darkvengance's approach requires a Windows webserver with Excel installed in order to use COM. If you need a pure PHP solution that will run on any platform, then a library like PHPExcel will allow you to create/populate an Excel worksheet directly from PHP
-
Escape the quote in Da Corleone's (mysql_real_escape_string)
-
Not to mention there's plenty of scripts in the Tests directory, showing how to instantiate a workbook, populate and format cells, and write out the file
-
That's definitely more interesting, and I'll look forward to seeing it when you're ready
-
I suspect he was, but I wanted some clarification before offering any solution