kenrbnsn
Staff Alumni-
Posts
8,234 -
Joined
-
Last visited
Everything posted by kenrbnsn
-
That's not necessarily true. On my server that's not the case. It really depends on the server's configuration. Ken
-
What does your form look like? Ken
-
What is the value of the variable you're testing? The syntax looks correct, but why are you using a for loop? Since you don't use the variable $row in the if statement, you're testing the same value every time. Ken
-
The "From:" email header should contain an email address and you should be using double quotes, not single quotes when the strings contain variables. <?php $headers .= "From: $fname $lname <$email>\r\n"; $fromaddress = "-f $email"; ?> Ken
-
What you may want to do is to create a small script on the server where the files reside. The output of this script would be a list of the files you want. You would then invoke this script using curl(), file(), or file_get_contents() to get the list. Then you can proceed with your code. Of course you should put some sort of security into the script so that it wouldn't work for anybody but your calling script. Ken
-
Why don't you use the glob() function and just get the files with the extensions you want? <?php $files = glob('pics/*.{jpg,png,gif}',GLOB_BRACE); echo "Files: <br />\n": foreach ($files as $file) { echo basename($file) . "<br />\n": } ?> Ken
-
You are not using the mail() function correctly. Read the manual page. Ken
-
Try this for your function: <?php function randomize(){ $chars = array_merge(range("a","z"),range("A","Z"),range("0","9")); shuffle($chars); return implode('',array_slice($chars,0,10)); } echo randomize(); ?> Ken
-
This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=325953.0
-
After the line that sets the value of $city, probably <?php preg_match_all('~<option\s+value="(.*?)">(.*?)</option>~', $data, $city); ?> Ken
-
What is printed if you do <?php echo '<pre> ' . print_r($city,true) . '</pre>'; ?> Ken
-
Splitting contents of file up to multiple files
kenrbnsn replied to devWhiz's topic in PHP Coding Help
One way: <?php $orig = file('orig_file.txt'); $new = array(); $new[] = 'dmy'; for($i=0;$i<count($orig);$i += 2) { $new[] = array($orig[$i],$orig[$i+1]); } for ($i=1;$i<count($new);++$i) { file_put_contents($i . '.txt',implode('',$new[$i])); } ?> Ken -
Function to remove predifined characters from the end of the string
kenrbnsn replied to pioneerx01's topic in PHP Coding Help
The rtrim() function works fine for this: <?php $str = 'Hello World!'; echo rtrim($str,'ld!'); ?> Ken -
NEWBY form to email in iframe using drupal
kenrbnsn replied to kevinsanthi's topic in PHP Coding Help
When posting code in this forum, please put it between tags. Ken -
A field that is marked as "disabled" is not sent when the form is submitted. Use the "readonly" attribute. Ken
-
I'd use str_replace() <?php $str = "this string has both single quotes ' and double quotes " . '" in it'; $str = str_replace(array('"',"'"),'',$str); echo $str; ?> Ken
-
The code you posted doesn't have 111 lines. Ken
-
Please post all your code and the full error messages. Ignoring errors just because the "code runs fine" is like ignoring the warning when the gas gauge on a car warns that the car is low on gas. Yes, the car is running fine when the warning is given, but if you don't get more gas soon, the car will stop. If you ignore the error, eventually it will cause problems. Ken
-
DO NOT use PHP4. Learn PHP5. If you are having problems with PHP5, post them here and we can help you. Ken
-
Global in a Function Inside a Function Does Not Work?
kenrbnsn replied to chaseman's topic in PHP Coding Help
In this case you want to return the array back to the calling function. In the fetch_all function, do <?php $page_ary = pagination_start ($dbc, $query); ?> In the pagination_start function, do <?php return (array ($offset, $rows_per_page, $current_page, $total_pages)); } ?> and delete the line <?php global $pag_array; ?> Ken -
retrieve date and time from mysql field using strtotime
kenrbnsn replied to bickyz's topic in PHP Coding Help
Use <?php list ($date,$time) = explode(' ',date('d M Y H:i',strtotime("{$row_rs1['upddate']} {$row_rs1['updtime']}"))); echo "$date $time"; ?> But doing it in the MySQL query would be simpler. Ken -
retrieve date and time from mysql field using strtotime
kenrbnsn replied to bickyz's topic in PHP Coding Help
Is the time field in 24 hour format or 12 hour format? Ken -
I took the code you posted and put it on my machine an it seemed to work fine. Is there any other code that might be interfering with this code? Ken
-
And the new error is? Ken
-
What do you mean by "doesn't work"? We're not mind readers. Also, please wrap your code in tags. Ken