Jump to content

RussellReal

Members
  • Posts

    1,773
  • Joined

  • Last visited

Everything posted by RussellReal

  1. ok.. PHP can't handle excessive amounts of data being stored in it.. so if you have a variable with tons and tons of data, php will produce a fatal error.. what you CAN do, is OUTPUT the data, or store it within a text file, until you're done processing the data, unloading the variable regularly during the process.. then output the contents of the file where it belongs, and that should avoid the error, although I'm sure there are OTHER, BETTER ways.. that is the best way I could think of
  2. I just got on MSN but no add request =\
  3. #1, slow emails are usually the outcome of slow email SERVERS, and slow email servers (since they're usually very fast) is because of overfilled shared servers.. Want the emails to be delivered faster? Get a VDS/VPS or DS hosting plan VPS and VDS are actually good alternatives to shared, as they usually give you dedicated resources. I currently have 2 VDS 1 on westhost.com and 1 on jumpline.com, the jumpline one is horrible and I'm getting rid of it at the end of this month... its horrible because the price is too high, however, the quality they provide, is 'okay', westhost is just as good (I think), and way more space and transfer, but so much cheaper, so they must not be giving you sumfin, or underselling themselves, or selling more VDS per server, either way, VDS > SHARED
  4. add me to MSN: RussellonMSN@hotmail.com I was writing you a regex the other day, but the power went out and I lost it, so I want to help you out via msn that way atleast I can explain most of it to you, or send you previews, etc. Sorry
  5. you have msn? add me: RussellonMSN@hotmail.com
  6. !-f is if the file doesn't exist
  7. I'm thinking that foreach loop should work =\
  8. sigh.. dude, you asked how to contain the returned value in a variable.. lol
  9. yes.. just explode by \n $ingredients = explode("\n",$row['ingredients']); for ($i = 0; $i < count($ingredients); $i++) { if (($i + 1) % 2) $rightSide[] = $ingredients[$i]; else $leftSide[] = $ingredients[$i] } print_r($leftSide); print_r($rightSide);
  10. ken, dude, preg_replace, he used preg_replace to replace the entire string with the back reference, but yes, preg_match would ofcourse be the better option, but unless I'm missing the big point, this should have been enough to make it work.
  11. not to be rude, but it'd probably be wise for you to learn php.. instead of ask 40 questions to get the script working the way you want it to, I know asking questions is healthy, but php basics, almost every php programmer's first code is a 'hello world' code, or something rly basic, unless they skipped ahead (like me) and aimed for something and skimmed php.net every 10 seconds.. and in the hello world, you echo 'hello world!';, in which case you'd probably understand what a string is, and what echo does, and like a lesson later or next step up would be learning variables, since PHP is ALL ABOUT variables.. like every other language.. so you'd know that substituting 'echo ' for '$whatever = ' in this statement: 'echo filtercode($data);' would capture the return of filtercode(..) and store it in $whatever, now, I know I sound very mean.. but taking the 30 minutes to do some tutorials doesn't ever hurt. Sorry again, Russell
  12. set a variable, like $loop; set it to 0 $loop = 0; foreach (.....) { $loop++; if ($loop == 10) break; }
  13. you are only selecting 'name' try this: SELECT name, (EXTRACT(YEAR FROM NOW()) - EXTRACT(YEAR FROM birth_yr)) As age FROM prime_minister
  14. it shouldn't cause any lag, pull the data like you'd usually do.. and then assuming in the field the ids would be seperated by commas, e.g. 1,17,23,30,20,10 if (in_array($this_user_id,explode(',',$row['viewed_by_id']))) { // user has viewed this topic }
  15. $data = preg_replace("(title:(.+?)\;)is",'$1', $data); preg_replace's arguements are pattern, replacement, input now, $N is used to reference the back references, which are captured thru capturing groups.. so your regex "/(title:(.+?)\;)/is" will match in the FIRST backreference(capturing group) (title:.... so it will capture everything that comes up inside the ( ), then you nested another capturing grou inside the first capturing group, which then sets whatever gets captured into the NEXT backreference up which would be the SECOND so in your current example, you'd want to use $2 in the replacement, not $1, which would return the first reference, which is everything + the second reference (in your example, its hard to explain) $data = preg_replace("/title:(.+?)\;/is",'$1', $data); use that instead, that would be better
  16. oh yeah, RewriteEngine, no he doesn't need the conds, if the regex is looking for .png RewriteEngine on RewriteRule ^blah.png$ blah.php well, okay, the first rewrite cond, could be useful, but the second one is excessive
  17. $1 references the first backreference, $2 will reference the nested backreference
  18. try echoing sumfin before including config.php..
  19. dude.. all these posters are dummies.. do this make a file called .htaccess and inside the .htaccess put RewriteEntine on RewriteRule ^blah.png$ blah.php and inside blah.php put the image generation code..
  20. <?php $pass = $_POST['pword']; $check = $_POST['check_pass']; if (($pass == $check) && (strlen($pass)) { echo "yes"; } else { echo "no"; } ?> this would be a tad more secure, however, there is no error in ur php.. I think you're sending them as the wrong names you're expecting
  21. actually, what would be cool, (which I've created something similar to this), instead of AJAX, you set up a 1 x 1 px flash app, and inside the app you connect to a server (I made my server in PHP), send the flash policy file and everything else, THEN that connection should be kept alive, thus, when an update becomes available, you just send the update to every connection that is connected, and that is as real time as you can get, without any kinda lag for the end user -- sorry, extra info.. I connected the server and user via a socket, but it probably wasn't hard to get the correlation
  22. try something like this: <?php $fields = array('fname','lname','phone'); $valids = array("/^[a-z'-]+$/i","/^[a-z'-]+$/i","/^1?\s?[\.\)]?\s?\d{3}\s?[\.-]?\s?\d{3}\s?[\.-]?\s?\d{4}$/"); foreach ($fields as $k => $v) { if ($_POST[$v]) { if (!preg_match($valids[$k],trim($_POST[$v]))) { // error, field doesn't pass validation break; } } else { // error, field isn't filled in break; } // field passes validations } ?>
  23. (?:[01]?\d\d?|2(?:[0-4]\d|5[0-5])) this basically matches any number between 0 and 255, with the exception of like 001 which is also possible to see, akwardly enough, in an IP. then, I attempt to match that same thing, but with a dot at the front, 2 times, since you just want to remove the last number. (?:\.(?:[01]?\d\d?|2(?:[0-4]\d|5[0-5]))){2} and then, the last one, is just another match from 0 - 255, with a word boundary expected \b to tell it to attempt all numbers, instead of match then exit (?:[01]?\d\d?|2(?:[0-4]\d|5[0-5]))\b the first 3 parts, I captured it in a backreference, then used it in the replacement $1.xxx, which translates in plain english, {First 3 Parts}.xxx its regex, if you want to learn regex you should check out regexbuddy.com, they sell a product but they also give free regex tutorials. goodluck tyra, Russell
  24. <?php echo preg_replace("/((?:[01]?\d\d?|2(?:[0-4]\d|5[0-5]))(?:\.(?:[01]?\d\d?|2(?:[0-4]\d|5[0-5]))){2})\.(?:[01]?\d\d?|2(?:[0-4]\d|5[0-5]))\b/",'$1.xxx','123.230.192.222'); ?> this works, just tested it
  25. you are not connecting to your database, or the query returns nothing..
×
×
  • 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.