-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
After the while loop use a for loop: for (; $i and output your default image inside that.
-
Was that a question?
-
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.
-
IP2Location Database IPv6 conversion to IP Number Decimal
requinix replied to brentman's topic in MySQL Help
Note that it seems there is a separate database/table for IPv4 and IPv6 addresses. Same query, different table. -
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?
-
Take out... I would think you should leave the validation in there, just don't validate it as an email address.
-
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.
-
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?
-
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.
-
I've always suspected that but never seen it done before in reference-quality material (documentation, tutorials, etc).
-
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.
-
Copy/paste fail: you're trying to validate the subject like an email address.
-
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){
-
...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.
-
...strlen?
-
Where is the array? It has to be somewhere in the HTML or in the Javascript (or retrieved from the server through AJAX).
-
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.
-
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?
- 4 replies
-
- parse error
- syntax error
-
(and 1 more)
Tagged with:
-
That file is less than 196 lines long and does not have any syntax errors.
- 4 replies
-
- parse error
- syntax error
-
(and 1 more)
Tagged with:
-
DECLAREs have to come before everything else.
-
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.
- 5 replies
-
- here document
- vaule
-
(and 1 more)
Tagged with:
-
The third, if pwm contains "#lblpasswordmessage". Or if it doesn't include the hash sign then $("#" + pwm)
-
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"; ?>