Jump to content


[Snippet] RSS FEED


  • You cannot reply to this topic
32 replies to this topic

#31 Ralph

    Loves Etomite Forums!

  • Admin
  • 6,506 posts
  • Gender:Male

Posted 13 December 2008 - 02:27 PM

View PostMoRRiS, on Dec 13 2008, 06:56 AM, said:

Hi, with some help of a friend, i think i created a query that does work now, if i am sure it works i will upload it later. (should i upload the complete snippet's code, or just the changes i made?)
The mysql version i use is 5.032 (debian installation)

MoRRiS.

Great... If the code works and all you've changed is the query itself, posting the new query code should suffice... Either way is fine, however - especially if you'd like credit for the potential improvement...

#32 MoRRiS

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 13 December 2008 - 02:29 PM

View PostRalph, on Dec 13 2008, 03:27 PM, said:

Great... If the code works and all you've changed is the query itself, posting the new query code should suffice... Either way is fine, however - especially if you'd like credit for the potential improvement...


Only changing the query wasn't enough. since the script started with the UNION parameter further on in the script the wrong column names where used. the best way would be to clean up the complete snippet, but right now we just swapped the colomn names wich is a little dirty :)

#33 MoRRiS

    Etomite Forum Newbie

  • Member
  • 7 posts

Posted 13 December 2008 - 02:44 PM

ok, the code changes so far.
change the existing query:
 $sql = "SELECT * FROM $tbl1 WHERE keyword='RSS' OR keyword='rss' UNION SELECT * FROM $tbl2 WHERE keyword_id > 0";
	  
	   $resourceArray=array();
	   $result = $this->dbQuery($sql);
	   for($i=0;$i<@$this->recordCount($result);$i++)  {
	   
		 array_push($resourceArray,@$this->fetchRow($result));
	   
	   }
	  
	  //extract the document ids, pop the ist field off with keyword results
	   for($i=1; $i<count($resourceArray); $i++){
		  $RSSDocs[]=$resourceArray[$i]['id'];
	   }
into:
 $sql = "SELECT * FROM $tbl1 WHERE keyword='RSS' OR keyword='rss'";
 $result = $this->dbQuery($sql);
 for($i=0;$i<@$this->recordCount($result);$i++)  {
	$row = $this->fetchRow($result);
	$rss_ids.= ','.$row['id'];
 }
 
 
 $sql = "SELECT content_id AS id FROM $tbl2 WHERE keyword_id IN (0".$rss_ids.")";
	  
	   $resourceArray=array();
	   $result = $this->dbQuery($sql);
   //	echo 'aantal results uit query: '.$this->recordCount($result);
	   for($i=0;$i<@$this->recordCount($result);$i++)  {
		   
		 array_push($resourceArray,@$this->fetchRow($result));
	   
	   }
	  
	  //extract the document ids, pop the ist field off with keyword results
	   for($i=0; $i<count($resourceArray); $i++){
		  $RSSDocs[]=$resourceArray[$i]['id'];
	  //	echo 'ID: '.$resourceArray[$i]['id'].'
 ';
	   }

So far, this is what i changed to make it work. I hope it will help people :)

(hmm, the debugging comments may be deleted :) )

Edited by MoRRiS, 13 December 2008 - 02:45 PM.






1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users