Reply to Re: Speeding up a function

Your name:

Reply:


Posted by Chung Leong on 10/28/06 01:43

Rik wrote:
>
> Well, it would be simpler for us if you could describe what it is exactly
> what you're trying to do, instead of letting us decypher it.
>
> 1. You can use a WHERE REGEXP to have a small result to check from the
> database.
> 2. In the case, I really advise preg_replace() to change the img src
> instead of the exploding, looping strpos, str_replace etc. This can be a
> one-liner.
> 3. MySQL has a handy REPLACE INTO, as long as you have a correct key, it
> would mean that no checking on already existing rows is required.
> --
> Rik Wasmus

Combining all the insert/replace operation into one statement would
help as well. Instead of doing a query immediate, store the links in
different arrays like this:

$images[$url] = true;

That collapses duplicate links in the page being parsed. Then it's just
a matter of looping through the arrays to build sql statements that
would create the records in one fell swoop.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация