Jump to content

hitman6003

Members
  • Posts

    1,807
  • Joined

  • Last visited

Everything posted by hitman6003

  1. Then you will want to look at the section of the manual on file uploads... http://us2.php.net/manual/en/features.file-upload.php
  2. Just loop through the string for the characters you are looking for and replace the occurrence... $string = "abcdef:ghijkl:mnop:qrs:tuvw:xyz:ABCD:EFG:HIJKL:MNOPQ:RSTU:VW:XYZ"; $num_found = 0; for ($i = 0; $i < strlen($string); $i++) { if ($string{$i} == ":") { $num_found++; if ($num_found == 5) { $string{$i} = "\n"; $num_found = 0; } } } echo $string;
  3. Why is this query just floating in the middle of nowhere? ("INSERT INTO information (usernm) VALUES ($_SESSION['MM_Username'])"); I'm assuming you want something like: $insertSQL = sprintf("INSERT INTO information (usernm, favsong) VALUES (%s, %s)", $_SESSION['MM_Username'], GetSQLValueString($_POST['textfield'], "text"));
  4. strpos will return FALSE if the string isn't found. That is why Orio uses the triple = when determining if the double slash is in his string.
  5. The concatenation character in php is a period ( . ). print '<form action="contactus.php?' . $_SERVER['QUERY_STRING'] .'" method="POST">';
  6. Yes, you are correct...I must be getting stupider or something...sorry about that Jesi
  7. I'm no flash expert...by any stretch of the imagination...but it looks like this: mailSendLV.e-mail = "yyy@yyy.com"; would be where the mail gets sent to.
  8. I'm not sure why Jesi pointed out the difference between "==" and "=" above because you had it correct the first time. The second posting of your code has the incorrect assignment operator ("=") where you want the comparison operator ("==") in your if / else statements. Echo $contact_to to see what it is equal to. Since it is assigning $email_to to the default value, $contact_to isn't equal to what you think it is or should be.
  9. If there is only one group (option in the select box), and you have to chose a group in order to proceed in the app, but that option is already chosen for you, there would be no way to chose that option and the form never gets submitted by the onchange event, which stops progress. Hopefully that makes sense.
  10. It will create an empty element. Also, if it is tab delimited, use the "\t" character to explode on.
  11. Are you sure that your "GetFiles" function is returning correct results? Try using ftp_nlist http://www.php.net/ftp_nlist
  12. Which line is 30? And why not use a switch statement? They're much easier to read, and provide the same functionality. (Jesi beat me to that one)
  13. It would be much easier for us to help if you could post the code related to getting the data to populate the drop down, as well as the code that generates the drop down.
  14. It executes the text passed to it as javascript. http://www.w3schools.com/jsref/jsref_eval.asp It's defined at the beginning of execution: var the_obj; It is assigned a value of the result of the eval function. Then it is added as an option in a select box. This script that you are using will not do anything with JSON...it executes javascript returned from the server and appends the result to a select box option group.
  15. Oh, and check the multi-byte string settings:
  16. The only thing I can think of would be to force php to output a default character set by setting the "default_charset" directive in php.ini
  17. If you are going to have a site that has tutorials and sells code for different languages you should probably get the language name correct...I know it's minor, but "Visual Basics" should be "Visual Basic"... http://msdn2.microsoft.com/en-us/vbasic/default.aspx
  18. Yet again, the manual holds the answer... http://us3.php.net/manual/en/function.array-search.php#71746 The function provided there can very easily be modified to use the str_pos function, strstr function, or any other string function if you are not comfortable with regular expressions.
  19. Please don't double post. Use array_multisort.... http://www.php.net/array_multisort
  20. The same way you have a default option in a regular select... <select name="selectbox" size="1"> <option selected>Option 1</option> <option>Option 2</option> </select>
  21. nl2br doesn't remove the newline characters in only inserts an html break before them.... http://www.php.net/nl2br he needs them to be removed.
  22. It isn't necessary to quote the table and column names except in certain situations, however you can not use a single quote when you do.
  23. If you are going to wrap a table or column name in anything it has to be a back-tic....as stated on this page in the mysql manual: http://dev.mysql.com/doc/refman/5.0/en/identifiers.html#id2817618
  24. This code should work...although since it takes a bit to process all of the text data you will want to cache the data from noaa and refresh it every hour or so to avoid excess traffic and processing on your server. //get the data $wave_data = file("http://www.ndbc.noaa.gov/data/realtime2/41002.spec"); $lines = count($wave_data); //strip extra spaces from the first line $columns = preg_replace('/\s\s+/', ' ', $wave_data[0]); //get the column data $columns = explode(" ", trim($columns)); for ($i = 1; $i < $lines; $i++) { //strip extra spaces from the line $line = preg_replace('/\s\s+/', ' ', $wave_data[$i]); //explode into elements $line = explode(" ", trim($line)); $cnt = count($line); //build an array where we can reference the data for ($j = 3; $j < $cnt; $j++) { $data[$line[0]][$line[1]][$line[2]][$line[3]][$columns[$j]] = $line[$j]; } } //with the above array, we can reference the data in the following way: $year = '2007'; $month = '02'; $day = '16'; $hour = '20'; echo $data[$year][$month][$day][$hour]['SwH']; echo $data[$year][$month][$day][$hour]['STEEPNESS'];
  25. $str = 'Joe Bloggs 2345 Pleasant Road Auckland New Zealand'; $search = array("\n\r","\n","\r"); $str = str_replace($search, "<br />", $str);
×
×
  • 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.