Jump to content

kenrbnsn

Staff Alumni
  • Posts

    8,234
  • Joined

  • Last visited

Everything posted by kenrbnsn

  1. That's not necessarily true. On my server that's not the case. It really depends on the server's configuration. Ken
  2. 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
  3. 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
  4. 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
  5. 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
  6. You are not using the mail() function correctly. Read the manual page. Ken
  7. 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
  8. This topic has been moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=325953.0
  9. After the line that sets the value of $city, probably <?php preg_match_all('~<option\s+value="(.*?)">(.*?)</option>~', $data, $city); ?> Ken
  10. What is printed if you do <?php echo '<pre> ' . print_r($city,true) . '</pre>'; ?> Ken
  11. 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
  12. The rtrim() function works fine for this: <?php $str = 'Hello World!'; echo rtrim($str,'ld!'); ?> Ken
  13. When posting code in this forum, please put it between tags. Ken
  14. A field that is marked as "disabled" is not sent when the form is submitted. Use the "readonly" attribute. Ken
  15. 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
  16. The code you posted doesn't have 111 lines. Ken
  17. 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
  18. DO NOT use PHP4. Learn PHP5. If you are having problems with PHP5, post them here and we can help you. Ken
  19. 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
  20. 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
  21. Is the time field in 24 hour format or 12 hour format? Ken
  22. 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
  23. What do you mean by "doesn't work"? We're not mind readers. Also, please wrap your code in tags. Ken
×
×
  • 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.