Jump to content

premiso

Members
  • Posts

    6,951
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by premiso

  1. If you view the source you will see the proper indentation / new lines. In order for the browser to see it you will need to put inside of a <pre> tag: <?php echo "</pre>hello \t world \n"; echo "hello \t universe \n</pre>"; ?> Browsers tend to hide those due to the fact that html can have a ton of tabs and new lines in it that are not meant to be displayed.
  2. Look at line 24 and see what's a miss, perhaps use a syntax highlighting program to code in? ."Special Instructions: ".$specialinstructions."\n"; Replace the semicolon in that line with a comma. ."Special Instructions: ".$specialinstructions."\n",
  3. Just tried this: <?php $summary = "some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. some tideous summary that I just decided to copy. x"; $trunc = myTruncate2($summary, 10); echo $trunc; /* Outputs: some tideo... */ function myTruncate2($string, $limit, $break="", $pad="...") { // return with no change if string is shorter than $limit if(strlen($string) <= $limit) return $string; $string = substr($string, 0, $limit); if(false !== ($breakpoint = strrpos($string, $break))) { $string = substr($string, 0, $breakpoint); } return $string . $pad; } ?> And it worked as expected. Perhaps your blurb function is echoing the content instead of returning it as a string. To capture the echo look into ob_start and ob_get_clean to add around the $summary = portion. Or, the more preferred method, modify the blurb function to return the summary and not echo it.
  4. I really doubt anyone will code this for you. If you are not willing to do the searching / put for the effort post in the freelance section and offer to pay someone for their troubles. If you are willing to put forth effort, here is a site I found by google: http://www.trap17.com/index.php/automatic-login-curl_t38162.html That should help you in your quest.
  5. It is called include's.
  6. Assuming you are using MySQL: SELECT score FROM table_name ORDER BY score DESC
  7. There is a way better way, use sessions to pass it. This will keep it internal to the server.
  8. You are not listening to anything anyone is telling you. Do a Right Click -> View Source on that localhost page you just put a give image. Inside there you will see the generated HTML Source code, look for the <img tags and look at the src attribute in them. Now, once you have that look at the structure as it will be something like: <img src="/some/url/image.gif"> given that you should be able to see where it is looking for the images at. If there are no images at that location that is your problem. It is as simple as that. The location the image tag is looking for the images is non-existent. The sooner you accept that the sooner you can fix your problem. The only 2 ways for the red x's to appear is the image NOT being at the location, or the image not being an image (or not being served properly by the server).
  9. Either have a cron job that runs once a day every day (if on Linux) or a scheduled task (if on windows) that runs a query against the DB and sends a mail to all users on their birthday.
  10. 300mb clone attempt? Last I checked firefox download was no bigger than 10MBs, parhaps the install is bigger, but to download it takes less than 30 seconds on internet speeds today. Actually I can believe that. Given this logic you should still be using a Linux Terminal for your OS and Lynx Browser to browse on. As the "non-flashy" browsers will beat the performance of any graphical / flashy browser and the same goes with the operating system. Now, if you prefer to not have the perks of say IE8, which is the Addons it can handle, Tabbed Browsing, search feature built in for whatever engine you want and more conformed to standards. Go right ahead and stick to IE6. As it will perform as you want it. For me, I like my Addons from Firefox and I like the ability to skin Firefox and have Tabbed Browsing. Those are just my preferences, performance is not as much of a priority as functionality is. I can use a Graphical OS and Browser, and I do want them to be a bit more flashy even though it will hit the performance a little bit. Obviously you just care about performance over functionality, which is your choice, for me I like a mixture of both.
  11. . Yes, it is possible.
  12. Here is a bit more of an explanation, yes the code is right to an extent. function helloWorld($param) { if(isset($param)) { return true; } else { return false; } } // will work. if(helloWorld('test') != false) { echo 'it worked!'; } else { echo 'Nope!'; } // will also work if(helloWorld('test')) { echo 'it worked!'; } else { echo 'Nope!'; } // Will also work if(helloWorld('test') !== false) { echo 'it worked!'; } else { echo 'Nope!'; } Either of the 3 works, the first method check if the value is false, meaning 0 would count. The second is just passing the return value to the IF statement as if statement check for true / false conditions so why add the check there (unless you need to verify the false) which is where the !== comes into play. That verifies that is false and the type is a boolean and not just 0. Hope that helps ya.
  13. You are nearly there, you just need to fopen the links.txt file for writing (while truncating it) then inside the loop do an fwrite to write the lines to the file and finally before the ?> do an fclose on the links file.
  14. You will have to set the headers and use readfile. The header type you are looking for would I believe by Content-Disposition: attachment; which should give you a starting point. If not I am sure Google has a ton of tutorials on this.
  15. $text = "text, text text, text"; $text = str_replace(",", ",<br />\n", $text); echo $text; If you want new line, remove the <br /> if you want an html break, leave it as is.
  16. UPDATE customer SET (account_id = account_id + 1 WHERE code = 1800), (account_id = account_id + 2 WHERE code = 2000), (account_id = account_id + 3 WHERE code = 2400) Give that a shot.
  17. Sell it to KY Gel for their "Hers and His" commercials
  18. echo date('h:i', time()-60*60*24); That is one way to do it. (Given that I did the h:i right).
  19. It has not been mentioned, perhaps his server does allow it or maybe he can set the server to allow it. Either way it is an option and a pretty good way to do it if it works. Definitely worth mentioning and worth him trying, if it does not work, well at least he tried it. Would you rather me not mention it to him and have him try it? This is a solution to the problem, as such I decided to enlighten him to it.
  20. PHP requires a server to run on or the php software. If you are on windows look into WAMP as it will do the PHP / APACHE / MySQL setup for you.
  21. ftp_rawlist Since you are using FTP and you want to fetch files in subdirectories look at that function: <?php $conn = ftp_connect("yoursite.com"); ftp_login($conn, "YourUserName", "Your Password") or trigger_error("FTP Login failed"); // ftp_rawlist (ftp connection, path, recrusive $buff = ftp_rawlist($conn, "/path/you/want/", true); echo "<pre>"; print_r($buff); echo "</pre>"; ?> Should be what you are after. You would do a foreach on the $buff array and just do simple checks etc. Hope that is what you are looking for.
  22. I just tried this: <?php $val = " £23443"; if (strpos($val,"£") !== false) { $val = str_replace ("£","",$val); echo $val; } on my server and it worked just fine...
  23. Two problems: if(mysql_query($access)){ $resultaccess = mysql_query($access); echo('$resultaccess'); } First, you are doing the query twice. Second, you are echoing a variable inside of Singlequotes, which takes $ literally. Revised version: if($resultaccess = mysql_query($access)){ $count = mysql_result($resultaccess, 0, 0); echo "Returned: " . $count; } As an offtopic note, you really do not need to go in and out of PHP like you do, stay in PHP while you are processing PHP. No need to go in and out.
  24. The problem with that function is eregi is depreciated in PHP6. It is advised to use preg functions instead, as they are not being depreciated.
  25. You have to fetch the data from MySQL mysql_connect, mysql_select_db mysql_query and finally mysql_fetch_assoc. Look into those functions or google a tutorial on how to pull data out of MySQL using PHP
×
×
  • 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.