Emiliano wrote:
>
> pp wrote:
>
> > for($i=0; $i<count($list);$i++) {
> > $article = is_something_from_$list;
>
> don't know how to read this, but...
but it works :))) I don't want to write all code here , it has as many
lines as midgard admin site ;)
> > $topicid = mgd_list_topics(id);
> > while ($topicid && $topicid->fetch()) {
> > if ($topicid->name == $sth ) {
> > /* this work fine */
> > $article_created = mgd_list_topic_articles ($topicid->id);
> > $article_created->fetch(); {
>
> what's that brace supposed to do?
>
> > if ($article_created->title == $article->title) {
> > echo "$article_created->title exists";
> > } else {
> > $topics = $topicid->id;
> > $name = $article->title;
>
> Don't you want $name = $article->name here?
hmmmm...... article i get has empty name so I thought I can force cretae
name from title
>
> > $title = $article->title;
> > $abstract = $article->abstract;
> > $content = 2;
> > $author = 2;
> > $url = 2;
> > $calstart = 2;
> > $caldays = 2;
> > $icon = 2;
> > $view = 2;
> > $print = 2;
> > $extra1 = "2";
> > $extra2 = "2";
> > $extra3 = "2";
> > $type = 2;
> > $next_article = mgd_create_article(0, $topics, $name, $title,
> > $abstract, $content,
> > $author, $url, $calstart, $caldays,
> > $icon,
> > $view, $print, $extra1, $extra2,
> > $extra3,
> > $type);
> > }
> >
> > And creates articles anyway. Nevermind if $article_created exists.
> > Why it works for topics but not for articles?
>
> The above code fetches the first article, compares the title (not
> name) and creates it. If you want to prevent duplicates you'll have to
> go through the entire fetch to determine if the name allready exists.
Would You write more "readable" version? I can really hardly understand
it.
Piotras
--
http://www.milinski.com.pl
http://www.infoglob.com
http://agaipiotras.igk.pl
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]