Jump to content

Adam

Moderators
  • Posts

    5,717
  • Joined

  • Last visited

  • Days Won

    6

Everything posted by Adam

  1. See my latest reply, think that's what you're after.
  2. Got it, rushed in before thinking you wanted the value of the parent. Here we go: $totals = array(); foreach ($array as $key => $child) { if ($child['parent'] == 0) { continue; } if (isset($totals[$child['parent']])) { $totals[$child['parent']]++; continue; } $totals[$child['parent']] = 1; } print_r($totals);
  3. $totals = array(); foreach ($array as $key => $child) { $totals[$key] = $child['parent']; } print_r($totals); Edit: Wait, I don't think I understand what you mean by "count how much data there is in each parent"?
  4. On a PHP forum I'd say it's fairly acceptable to presume that by "development" you were meaning PHP
  5. As I think mattal999 was getting at, you're trying to use mysql_fetch_object() on either an empty resource, or a boolean value (mysql_query() returns false on error). You should validate that rows were actually returned from the SELECT statement with mysql_num_rows, before trying to fetch the data object. For example: if (mysql_num_rows($carl) > 0) { $car = mysql_fetch_object($carl); } If you still receive some PHP errors for using mysql_num_rows(), you have an error in your syntax.
  6. Judging by the "[1]" it looks like he's planning to paginate them? If he doesn't, once all million are there the user will end up having to download about 20mb worth of images (assuming ~20kb per image), with a separate request for each. That will take the absolute piss to download and render.. Every penny? He stands to loose a lot of money, considering the bandwidth bill.
  7. I believe by default both the packages you mentioned are not configured to serve online.
  8. Made a grave error, I'm working from a SQL Server 2000 box. What would be the best alternative in that case then? Thanks
  9. Adam

    is_numeric ?

    Simplest way in my opinion would be to just use regex: if (preg_match('/[0-9]/', $str)) { // contains a number }
  10. Hi guys. This should be a pretty straight-forward question for any T-SQL developer; how can I use a parameter passed to a stored procedure within the TOP clause of a SELECT statement? For example: SELECT TOP @Length * FROM vanity_urls ORDER BY id ASC; Unfortunately this produces the error: "Incorrect syntax near '@Length'". Anybody have any ideas? Thanks Edit: To add I'm using SQL Server 2005, and tried the suggestion here of wrapping the parameter in brackets, however that didn't work..?
  11. Okay after catching the second half of Algeria loosing 1-0 to Slovenia, I think we can count on a strong win on Friday. Hopefully give the team a bit of a confident boost too..
  12. Yeah, god that was basic goal keeping.. Milner made some terrible tackles too! Plus Lampard was playing sh*t! Who weren't around when we qualified and played fantastic? Lampard! Why was Rooney playing so far back? Needed to get Heskey off way sooner, get Rooney up-front and just feed in some crosses! Don't know what they were doing. Plus them horns are just getting ridiculous, sounds like a chuffin' hornets nest!
  13. a seh! what the fuck was that performance???
  14. Do you mean onmouseover?
  15. Oh my god! I'm sorry, I'm not racist in anyway, but if they're living in ENGLAND they can't expect to get pissed off because someone's wearing an ENGLAND t-shirt! This stuff drives me mad! On a lighter note, woo yeah football! Going to pub Saturday to get shit faced and watch the match!
  16. @haku Judging by the "??" next to Java, I guess he's just unsure of the terminology. @gevensen It's JavaScript, not Java; they're 2 different languages. I think what you're looking for is AJAX (asynchronous JavaScript and XML), there's thousands if not millions of tutorials and frameworks available to make learning/using the technique easier. I'd have a play around and see what you can do; then if you get any problems come back.
  17. Yeah that's correct, it's an address.
  18. Actually I didn't mean to leave the $ in there, that matches the end of the string - you'll want to remove that. The "i" on the outside of the delimiters is the case-insensitive modifier, basically means the same as: /([a-zA-Z].*[0-9]|[0-9].*[a-zA-Z])/
  19. Well perhaps you should be clearer in future? You're English isn't exactly perfect. Anyway, first idea that comes to mind: var str = '£$ewe£$1556£$%£'; if (!str.match(/([a-z].*[0-9]|[0-9].*[a-z])$/i)) { alert("this field must contain at least 1 number and 1 letter"); }
  20. Yeah? var str = '££$%£'; if (str.match(/^[^a-zA-Z0-9]+$/)) { alert("this field must contain only alphanumerical characters"); }
  21. Hmm. Contradictory to what I said before that will actually POST their local path, it won't upload the image however. What exactly is the desired result (image path or actual image)?
  22. Can't really say without seeing your code, but it sounds like a bad implementation. You should put in a condition that will only overwrite the image if a file has been specified.
  23. Wait up.. if ((showThis).is(':hidden')) { Don't you mean..? if ($(showThis).is(':hidden')) {
  24. Sorry, spotted it now. Have you tried alerting the value of "showThis" just before the IF condition to ensure it's what you expect?
  25. The best thing to do here is just leave it blank, and instruct the user to only select an image if they want to overwrite it. The reasons for this are that, for one, when a file is uploaded to the server you only get the file and path to it's *temporary* location on the server; you don't get their local path. This means that you're unable to pre-fill the input with their local path, however even if you could it would mean re-uploading the file every time the form is submitted -- waste of bandwidth!
×
×
  • 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.