Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Well, you've got some kind of loop over users I assume? In pseudocode, $ipaddrcolors = array(); for each $user { if $ipaddrcolors[$user IP address] exists { $color = $ipaddrcolors[$user IP address] } else { pick a random $color $ipaddrcolors[$user IP address] = $color } color the user with $color }
  2. Keep an array of IP addresses and their random colors as you go through the list. If the address is in there already then use its color, otherwise pick a color, use that, and save it in the array.
  3. You can't say you want them random and then say you want them a certain color. Which is it?
  4. By the sounds of it yes. But without the quotes or semicolon, of course. 'firstName' => $Order->Customer->firstname
  5. Right, and I'm saying to use imagepng() to write the new image back out on top of the old image. You say you tried that? What was your code and what was the problem?
  6. imagepng can write the image back out to a file...
  7. Isn't it getting there? You do call it in sendxml().
  8. So what did the print_r() output? It should look like Array ( [0] => 123 [1] => 234 [2] => 345 )
  9. The URL problem is back. What did you do to fix it before?
  10. .toggle() is the next best thing: one function to add bold, one function to remove it. I say this because I find it too much of a hassle to write a .click() handler that manually detects state. But you can totally do that if you'd rather: this.style.fontWeight (inside the handler) is an easy place to look.
  11. Put the CSS into a class instead and use .toggleClass.
  12. Duplicate. http://forums.phpfreaks.com/topic/275391-how-to-check-image-on-if-statement/
  13. Considering how incredibly easy it is to prevent that kind of attack, and that the author didn't do it, there's a good chance there's more exploits to be found.
  14. First find the author of that plugin and see if there's an updated version. Otherwise change it to $query = 'select * from websiteirm WHERE id = ' . (int)$id; $result = $wpdb->get_row($query);
  15. requinix

    OO

    "Better" is subjective. Does the code look better? Yes. Is it suitable for highly-constrained environments, like those of low CPU or low memory or high performance? Generally not. Definitely useful: it's a bunch of functionality all in one place. It's often "necessary" in that 99% of the time you'll end up writing some set of common functions or classes and presto! you have a framework. To some degree. OOP greatly helps with coding and maintenance but at an expense. It also depends on the language: OOP in PHP will slow down the script and increase memory usage, while in C it's often done with macros and thus not very different from procedural code. It's always a good time to learn OOP.
  16. Are you including the authentication information in the request? It's not in that raw XML there in runxml().
  17. That's the original value, yes, but does the mycart_authorize_net_url filter do anything to it?
  18. Use AVG() but make sure to GROUP BY the company ID - otherwise MySQL will average out all the values.
  19. It doesn't look like you're actually creating the customer profile. At least the corresponding variables don't seem to be set anywhere. But that 400 response looks like it's coming from the web server, not the CIM software. In send(), what's the $url after the filter? And what's the code for the parent class?
  20. Your expiration date looks like it's in the wrong format but otherwise nothing stands out to me. Have you dumped out $transaction to see if it contains the right data? What error (presumably) comes back in the response when the request doesn't work?
  21. current() returns a value, not a key. Use key() instead.
  22. It looks like you have data normalization problems. Are you able to change the database structure? What do the tables look like?
  23. Alright, so long as you know that this only works on Windows. $last_mod = filectime("fname");You're telling it to look for a file named "fname". The $_POST array contains the value you need.
  24. You didn't even try to copy and paste your question here. Why should I bother going to another forum just to see what your question is? The answer is "probably".
  25. It's mostly a change to your query. In SQL a GROUP BY allows you to "combine" similar items (however you want to define that) and lets you use aggregate functions like COUNT() to give you information about each grouping. $query = "SELECT *, COUNT(1) AS count FROM uitems WHERE username='$showusername' AND location='1' GROUP BY theitemid";That will group items together according to the theitemid, and return back a column named "count" containing the number of items in each group. In your example it will be 2 for the gem and 1 for everything else; if it's not 1 then display the x? alongside the item. As for the JOIN, you really should learn to use it. Using nested queries like you're doing now is almost always a Bad Thing. Also you should avoid using SELECT *s unless you actually do want all of the information in the table (which you don't here). Try this: SELECT u.uitemid, i.name, i.image FROM uitems u JOIN items i ON u.theitemid = i.itemid WHERE u.username = '$showusername' AND u.location = 1 GROUP BY i.theitemid[edit] With this you only need the one loop. [/edit] But there's a problem. I think the uitemid is unique to each uitem? GROUP BY won't let you get more than one value for each group of rows: you'll get some uitemid for one of the two gems and you can't know which one it was for. So that impacts the link you output.
×
×
  • 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.