Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. After the while loop use a for loop: for (; $i and output your default image inside that.
  2. Was that a question?
  3. Here's a practical reason: What if you had 20 products? You'd have (up to) 20 different "computeProductX" methods. And that's just for computeProduct. Another method to customize means another 20 methods. Now you've got 40 methods to sift through when looking at the code. Do you really want to do that? Inheritance lets you do the same thing you're doing now but keeps the code a lot simpler. Each subclass has only the differences it needs. When you want to find how product M computes its whatever, you don't have to sift through dozens or even hundreds of methods to find the one you want, and instead you go to the M class and look at its computeProduct method.
  4. Note that it seems there is a separate database/table for IPv4 and IPv6 addresses. Same query, different table.
  5. Not the case. Same reason you would use classes in PHP instead of arrays of data and global functions. No. One of many reasons. What?
  6. Take out... I would think you should leave the validation in there, just don't validate it as an email address.
  7. Depending where those integers come from, and whether you can/need to get them as strings, PHP already has ways to remove duplicates from arrays and it's entirely C code. Most Linuxes have 64-bit PHP now. It's really only Windows which is stuck in 32-bit land.
  8. It starts by knowing C... Do you? For something as simple as math it won't be so bad but you do would need to learn about the PHP internals a bit. Yes, to a point. But the main problem is that your hosting company is probably not going to let you load a PHP extension. Have you verified they're even using Windows? Let me put it this way: if PHP's implementation is too slow then you shouldn't be using PHP at all. It's as "designed for this" as is, say, C. Exactly what is this math stuff?
  9. Write and compile a PHP extension that uses the DLL. But if the code isn't too much then you might as well ignore the DLL and put the code in the extension itself.
  10. I've always suspected that but never seen it done before in reference-quality material (documentation, tutorials, etc).
  11. And a third thing, if(!$stmt){will never be true. $stmt->execute(array( 'recordid' => $record_id, 'name' => $name, 'content' => $content ));The array to execute() uses names like "recordid" but it needs to match exactly the placeholder used in the prepared statement, $stmt = $db->prepare("INSERT INTO records(record_id, name, content) VALUES(:recordid, :name, :content");so that means it should be like ":recordid" instead.
  12. number_format
  13. PDO? The array to execute() is the entire placeholder name - including the colons.
  14. Copy/paste fail: you're trying to validate the subject like an email address.
  15. Taking a guess, The URL has to be absolute. That means a leading slash and the full path to where poll.php is. $.post('/path/to/poll.php', $(this).serialize(), function(data, status){
  16. ...no. First, open source is a concept - a license, really - not an implementation. You don't have to host your code on GitHub for it to be open source, and putting it on GitHub doesn't make it open source. Second, GitHub and others are code repositories. You don't keep your code there and then try to run it from there. It's a place you can store your files on the internet. When you want to run them, you download them (in the case of GitHub, using git) and run them. Locally. You could just as well put the files in a .zip on an FTP server and download the code for all it matters.
  17. ...strlen?
  18. Where is the array? It has to be somewhere in the HTML or in the Javascript (or retrieved from the server through AJAX).
  19. PHP will add files in the order they're presented, so it's up to the drag and drop code to deal with that. You can still sort in PHP, of course. There are four arrays in $_FILES that you have to sort at once so rather than sort() use array_multisort: you give it the four arrays (name, tmp_name, error, type) and it'll sort one and rearrange the rest accordingly. Check the examples there and give it a shot.
  20. FYI there was a non-breaking space in your link that was breaking (ha) it. I removed it. Which suggests to me another problem. If you copy/paste the code you posted (either from here or Digital Point) to replace what you have now, does it work?
  21. That file is less than 196 lines long and does not have any syntax errors.
  22. DECLAREs have to come before everything else.
  23. PHP has no idea you're trying to call a function named "getCardValues". As far as it knows, there's a whole bunch of text and then suddenly $pyramid and then a lot more text after. It's not going to try to guess what you want. You can use a variable and that's it. So put your getCardValues() stuff into a variable, do the same for the others, and insert those variables where you want the values to appear.
  24. The third, if pwm contains "#lblpasswordmessage". Or if it doesn't include the hash sign then $("#" + pwm)
  25. And if there's a space in front of the comment? Or a lone semicolon? [edit] And while I'm here, how are these files being executed? And what do you get if you do <?php //my comment //my comment //my comment //my comment //my comment echo "<pre>\n"; print_r(file(__FILE__)); echo "\n</pre>\n"; ?>
×
×
  • 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.