-
Posts
1,807 -
Joined
-
Last visited
Everything posted by hitman6003
-
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
-
[SOLVED] String Replace but with a difference
hitman6003 replied to willpower's topic in PHP Coding Help
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; -
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"));
-
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.
-
The concatenation character in php is a period ( . ). print '<form action="contactus.php?' . $_SERVER['QUERY_STRING'] .'" method="POST">';
-
Yes, you are correct...I must be getting stupider or something...sorry about that Jesi
-
Having trouble setting up flash based contact form.
hitman6003 replied to pnutbuttrjarz's topic in PHP Coding Help
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. -
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.
-
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.
-
It will create an empty element. Also, if it is tab delimited, use the "\t" character to explode on.
-
Are you sure that your "GetFiles" function is returning correct results? Try using ftp_nlist http://www.php.net/ftp_nlist
-
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)
-
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.
-
AJAX Using JSON, how do I read the object?
hitman6003 replied to JustinK101's topic in PHP Coding Help
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. -
Oh, and check the multi-byte string settings:
-
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
-
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
-
Please don't double post. Use array_multisort.... http://www.php.net/array_multisort
-
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>
-
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.
-
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.
-
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
-
Retrieving NOAA buoy data realtime text file for message board
hitman6003 replied to amount's topic in PHP Coding Help
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']; -
$str = 'Joe Bloggs 2345 Pleasant Road Auckland New Zealand'; $search = array("\n\r","\n","\r"); $str = str_replace($search, "<br />", $str);