Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. I don't have any links for you or anything, but I always thought that ACT was a POS system and it stores info an "a" database but not any one in particular, and it's up to the person in charge of that dept to decide what database to use. In other words, I was not aware that ACT had its own proprietary database...
  2. by specifying the correct charset in the email headers you send.
  3. assuming its not a syntax error, it's a constant.
  4. oh sure, blame it on the OP for giving inaccurate info. As if that happens all the time. Oh wait...
  5. it's (negligibly) faster and easier for most people to grasp (most people run away screaming at any mention of regex)
  6. at the very least you can assign count($array) or sizeof($array) to a variable before the loop, instead of putting it in the loop condition. When you put it in the loop condition like that, php has to evaluate that every iteration of the loop. Also, foreach would be fine. Just specify a key => value, and you can then use $key in the condition. Using the foreach would also get rid of the count/sizeof altogether. foreach ($array as $key => $value) in addition, you can add a break inside your condition to break out of the loop once it finds it. May not be that great if what its looking for is at the end. But it will save some iterations here and there. In addition to that, you could perhaps consider rethinking how you're storing the stuff in the first place. For instance, your user is picking something and the form is passing a value to this script that's looking for whatever. So why not make the value being passed, the array position in the first place? And I don't know what your overall goal here is but I see you first getting a value from the user, searching to see if it exists in some array, and then assigning the array key to some variable. I assume you're going to turn around and later use that to get the value from the session array anyways. Seems like you're making 10 steps out of 2.
  7. would be faster and less complicated to just explode at the hyphen but if you really want to do it with preg_replace it would be $string = preg_replace('~-.*~','',$string);
  8. so where's the code that actually calls your function?
  9. suppose you could make your script that parses the blah in blah.jpg and creates the image, and then make that script your custom 404 page.
  10. nrg your regex didn't work for him because it assumed <h2> instead of <h2[^>]*>
  11. it's because in his condition he uses $...q which is the actual query result. so basically, you two are scratching your heads because you fail to notice the difference between a q and a r . And OP's code technically works because it doesn't actually use that $...r var and so he's going to walk away thinking that's how its done and next time he's probably not going to typo the condition and then it really will break and he will have no idea why.
  12. guy doesn't know how to install the software he makes...isn't that some kind of paradox?
  13. is that your entire code?
  14. I don't think there's a preg_xxx, argument for a preg_xxx or a piece of regex itself where you can have it specifically return that. However, what you could do is match for all <h1>...</h1> and they will be returned in order of matches found. So you will know from $match that $match[0][6] or $match[1][6] would have the 7th match found.
  15. That is, we have no post count to reach before you can add a sig. We do have rules regarding what is allowed in a sig. RULES & TOS
  16. I think the OP is wanting the user to be able to hand out rep all day long to people, but he can't click the same person again until 24hrs have passed. All you need is a single table. 3 columns: userId, friendId, timestamp. Every time a user clicks on a link, your script checks to see if a row exists matching the user and friend. And the timestamp is less than 24 hours. You would then have a cronjob setup to run a script every 24 hours to prune old entries.
  17. I thought the point of the initial "show tables from db like ..." was to gather data from multiple tables and paginate it? If your code is currently doing exactly what you want, minus the limit, you would put it in your data selection query, where you select the actual data and order it, etc...
  18. Not trying to rub salt in the wound, but the "See Also" section of fopen does list file...
  19. file
  20. ah okay, I guess I didn't think ahead to how that would tie into the pagination itself. Okay, slightly modified advice: Run the show tables query. Then what you're gonna wanna do is loop through the result to build the query for your pagination. But you're going to incorporate UNION into the pagination query. So an example would be: $result = "(select * from table1) union (select * from table2) union (select * from table3) orderby somecolumn desc"; so what you're gonna have to do is loop through the results from the show table query and dynamically add (select * from tablename) for each table returned form the show table query. Then add on your order by column or desc or whatever.
  21. .josh

    Count

    array_count_values arsort
  22. No help at all that the non-tech people who dream up the projects think anything under the sun is possible/worth it, can be implemented in like an hour, and cost $1.
  23. well to be fair, back in the day, even 2 digits was a valuable commodity, memory-wise. And 2000 was a long time down the road, stuff you read about in sci-fi novels. It's not entirely unreasonable that they just assumed that far down the road, some entirely new system would be invented and implemented. And indeed, better systems were invented. Just that nobody got around to updating until the last minute. More a matter of procrastination than lack of foresight.
  24. As CarbonCopy mentioned, I do not believe you can use wildcards on a tablename when selecting like that. My advice would be to first do a SHOW TABLES ... and then loop through the results, with your SELECT inside the loop.
×
×
  • 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.