Jump to content

mikesta707

Staff Alumni
  • Posts

    2,965
  • Joined

  • Last visited

Everything posted by mikesta707

  1. well first of all. unless you defined it yourself, isSet is not a function. Perhaps you mean isset(). secondly, in your OP example, you aren't concatenating correctly. I'm assuming the page threw a "unexpected string" error. The example PFM gave you should theoretically work, although you could also do $result = mysql_query("SELECT * FROM " . $Trow['NameOfTable'] . " WHERE id = $counter"); if you wanted to. Both are equivalent.
  2. So you need to replace instances of the array keys with their respective values in some string. Use the array_keys() function. Like so $string = "some string with some stuff in it..."; $changes = array(...);//your changes array $newString = str_replace($array_keys($changes), $changes, $string); hope this helps
  3. I would use array_unique. It takes an array, and returns an array without duplicates, which seems to be exactly what you want. THe good thing about this is that you don't really need a condition to use this, because if the array is already without duplicates, array_unique will just return the original array unchanged. here is an example of usage of array_unique $array = array(... some array with a bunch of repeat values); $unique_array = array_unique($array); //now $unique_array has all the values of $array, without duplicates hope this helps
  4. It's most likely your code. Can you post it?
  5. As dathremar has said, you should probably read the manual entry for that function. Unless you have all unique values (in which case the frequency of each value would be 1) Then the number of values in F will always be smaller than the number of values in X. I'll give you an example. $array = array(1,2,3,4,5,1,2,4,5,6); print_r(array_count_values($array)); the output of that code would be [1] => 2 [2] => 2 [3] => 1 [4] => 2 [5] => 2 [6] => 1 Now, for what you ultimiately want to do, i'm a little confused. Do you want to take each value in X, and multiply it by its frequency? Or something else? if the former, you could do something like this $array = array(...); $frequency = array_count_values($array); foreach($array as $key=>$value){ $newValue = $value * $frequency[$value]; $array[$key] = $newValue; }//end foreach Hope this helps
  6. How exactly is it "not working". Not working can mean 1 of many many things, and without more information, its hard to pinpoint a problem. Is there an error? Is nothing happening? is something happening but not what you expect? Basically, we need to know what is happening, what you want to happen, and any other information (like if there is an error or something)
  7. Thanks! I just worked that out before you posted. I have another related problem. If I use... $values = array_count_values($array); print_r($values); I'm getting every value in the array except for the last one? any ideas why? Thanks! can you post the actual array you are using, and the actual result. array_count_values() gives you a sort of frequency histogram (in array form) of the input array.
  8. you could loop through the array, and replace all zero's with a one like so foreach($array as $key=>$value){ if ($value==0) $array[$key] = 1; }//end foreach
  9. its ok. It makes no difference really.
  10. hmm, that doesn't make much sense to me. When you leave the action attribute out, it, by default, submits to itself. By supplying the action (and setting it to itself anyways) this same behavior should occur. Are you positive that you are supplying the action correctly. When you say "its doesn't add the jpg file", what exactly happens? is there an error? blank page? However, setting the action to index.php and leaving out the action attribute all together is pretty much the same thing since index.php is the page where your form is, and the processing for your form is done
  11. I dont see why it wouldn't be possible. Seems very possible to me. I don't know everything about your/their system and setup, but you should be able to scrape that page for the information you want using DOM object.
  12. Well can/are you using Jquery or do you have to do this with pure javascript. Either way, i would do a google search on Javascript and the HTML DOM, and read a few tutorials on the subject before you get started on this
  13. I fixed the problem. I ended up simply calling the binded load function at the end of the live("click") event
  14. No problem. If your topic is solved, you can click the topic solved button at the bottom of the thread
  15. If I were to guess, I would say daylight savings time is causing the unexpected behavior. The math is correct, and I can't imagine that the timestamps being returned are wrong
  16. Well you could use regex for that, but if those non-bolded items will always be in the string, just replace them with a character that you know won't be part of the string, and explode based on that character. so for example $delimiters = array("EASTRIVANN", "CTY:", "LOC:", "XST:", "XST2:"); $replaceWith = "~";//replace the non-bolded text with a tilde character newMessage = str_replace($delimiters, $replaceWith, $message); //now explode on the ~ character to get all the pieces. $array = explode($replaceWith, $newMessage);
  17. just use javascript to set the visibility style to something other than hidden?
  18. If you are looking for someone to write the code for you, there is a freelance forum for that... If you are looking to for it yourself, some information on your situation would be appreciated. Like can you use different libraries? is Jquery an option? Do you need to do this in pure javascript? There are many free libraries that provide popup box like functionality. A quick google search may do you some good.
  19. does the script you are running have the correct permissions?
  20. Just posting code and asking "Whats wrong" isn't going to get you anywhere. you need to make some effort to get your question answered. We have no clue what this script actually even does, so asking us to trudge through some code trying to find errors is something not a lot of people are going to want to do (as you can see by the lack of responses in this thread) why don't you explain exactly what the problem you are having is. What is happening when you run this script. What do you expect to happen? When you provide more detail than "this doesn't work.. halp" you can get an answer a lot easier.
  21. maybe its because you dont use an extension. try adding an extension to the filename
  22. What you seem to not understand about preg_match is you need to create a regular expression pattern to match what you want it to match. It doesn't just magically match things if you give it to it. It doesn't know what you want it to match (and neither do I for that matter) Perhaps you should start by reading a few regular expression tutorials. This was the first result on google when searching for regex tutorials: http://www.regular-expressions.info/tutorial.html EDIT: sorry I missread your post. You do understand that you need the proper pattern. However, I still dont really understand what the criteria for matching will be. I don't need more examples of strings.. ideally your pattern should be predictable for any string you feed into it. What is the constant text? What is the data? You need to provide more information.. I simply don't know what you mean or are referring to.
  23. oh is that code not properly writing to the file? You never said that in your OP. Can you fully explain what exactly is wrong? Just so you know, you don't add a file extension to the file you are trying to write. Perhaps you forgot to do this?
  24. You weren't supposed to just copy paste the code he gave you. You were supposed to read the link he gave you (which apparently you didn't) and using that information, realize that you can set the encoding of the email you send via the additional headers argument. That tutorial he linked you seems rather straightforward. If you don't understand it, us giving you the answer won't help you. Try reading the mail() entry int he PHP manual.
  25. you seem to have answered your own questions... If the PHP DOM extension is faster and easier to use.. why not use it?
×
×
  • 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.