Loading ...
Sorry, an error occurred while loading the content.

Re: [bang-phpug] Re: help me!!!!

Expand Messages
  • Vijay Kansal
    Hi Vivek, Can you send the get_keywords function code? as i the following code(I have made some changes) only get_keywords is the funcrtion which takes time
    Message 1 of 8 , May 7, 2009
    • 0 Attachment
      Hi Vivek,

      Can you send the get_keywords function code? as i the following code(I have made some changes) only get_keywords is the funcrtion which takes time


      mysql_connect( "localhost" , "zzz", "zzz");
      mysql_select_ db("crawl" ); // database name
      $hosts=mysql_ query("select * from xyz where;");
      while($row=mysql_ fetch_array( $hosts))
      {
       
      $url=$row["name" ];
        $id=$row["id" ];
       
      $c=get_keywords( $url);
       
      if(strlen($c) ==0)
       
      $c="No Keywords";
       
      mysql_query( "update xyz set keywords= '$c\', kflag=true where id = '$id' ;");
       
      echo "done";

      }

      Thanks,

      Vijay Kumar
      --- On Fri, 5/8/09, vivek sachi <vivekkimi@...> wrote:

      From: vivek sachi <vivekkimi@...>
      Subject: Re: [bang-phpug] Re: help me!!!!
      To: bang-phpug@yahoogroups.com
      Date: Friday, May 8, 2009, 8:49 AM

















      hi,

      thanks for replying.... i modified the table and query as u said but did not work, i think the problem is tat get_keywords func is taking more time to return the result...hence it will work for first few entries in the database not for all. so is there any mechanism to ensure that the while loop waits until the func keywords returns.

      i tried using sleep but it halted the execution completely.



      ____________ _________ _________ __

      From: Koushik G raj <koushikgraj@ yahoo.com>

      To: bang-phpug@yahoogro ups.com

      Sent: Thursday, 7 May, 2009 8:52:00 PM

      Subject: Re: [bang-phpug] Re: help me!!!!



      Hi Vivek,



      why dont you use primary key field in where condition to update.

      if you have same url in multiple rows then every rows will updated in this case what you are using.



      and also u are updating the row one by one inside while loop.

      i think its better to use primary key field in where condition.



      --- On Thu, 7/5/09, vivekkimi <vivekkimi@yahoo. com> wrote:



      From: vivekkimi <vivekkimi@yahoo. com>

      Subject: [bang-phpug] Re: help me!!!!

      To: bang-phpug@yahoogro ups.com

      Date: Thursday, 7 May, 2009, 7:24 PM



      --- In bang-phpug@yahoogro ups.com, "vivekkimi" <vivekkimi@. ..> wrote:



      >



      > mysql_connect( "localhost" , "zzz", "zzz");



      > mysql_select_ db("crawl" ); // database name



      > $hosts=mysql_ query("select * from xyz where =0;");



      > while($row=mysql_ fetch_array( $hosts))



      > {



      > $url=$row["name" ];



      > $c=get_keywords( "$url");



      > if(strlen($c) ==0)



      > $c="No Keywords";



      > mysql_query( "update xyz set keywords= \"$c\" where name like'%$url%' ;");



      > mysql_query( "update xyz set kflag=true where name like '%$url%';");



      > echo "done";



      > }



      > /*



      > xyz is a table full of urls..i want to update this table by adding keywords of each page to the corresponding url.



      >



      > get_keywords is a func to extract keywords for a given url.



      >



      > kflag is used to detect if the keywords have been searched for..for the particular url.



      >



      > this code works fine when the table has very few entries say 4-8 but crashes when table contains 200 odd entries.



      >



      > i'm stuck here big time..i probably need to use multi threading but i'm not able to figure out how..



      >



      >



      > CODE RED!!! please help!*/



      >



      I tried after removing "like" from SQL but the problem remains the same.



      Bring your gang together. Do your thing. Find your favourite Yahoo! group at http://in.promos. yahoo.com/ groups/



      [Non-text portions of this message have been removed]



      Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition http://downloads. yahoo.com/ in/firefox/ ?fr=om_email_ firefox



      [Non-text portions of this message have been removed]































      [Non-text portions of this message have been removed]
    Your message has been successfully submitted and would be delivered to recipients shortly.