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

help me!!!!

Expand Messages
  • vivekkimi
    mysql_connect( localhost , zzz , zzz ); mysql_select_db( crawl ); // database name $hosts=mysql_query( select * from xyz where kflag=0; );
    Message 1 of 8 , May 7 2:57 AM
    • 0 Attachment
      mysql_connect("localhost", "zzz", "zzz");
      mysql_select_db("crawl"); // database name
      $hosts=mysql_query("select * from xyz where kflag=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!*/
    • Dhruva Sagar
      The problem actually lies in the like %url% SQL syntax in my opinion. The like param is not very Database friendly, you should always avoid using it, see if
      Message 2 of 8 , May 7 6:00 AM
      • 0 Attachment
        The problem actually lies in the like %url% SQL syntax in my opinion.
        The like param is not very Database friendly, you should always avoid using
        it, see if you can work around using a 'like'

        On Thu, May 7, 2009 at 3:27 PM, vivekkimi <vivekkimi@...> wrote:

        >
        >
        > mysql_connect("localhost", "zzz", "zzz");
        > mysql_select_db("crawl"); // database name
        > $hosts=mysql_query("select * from xyz where kflag=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!*/
        >
        >
        >



        --
        Thanks & Regards,
        Dhruva Sagar.


        Ogden Nash <http://www.brainyquote.com/quotes/authors/o/ogden_nash.html> -
        "The trouble with a kitten is that when it grows up, it's always a cat."


        [Non-text portions of this message have been removed]
      • vivekkimi
        ... I tried after removing like from SQL but the problem remains the same.
        Message 3 of 8 , May 7 6:54 AM
        • 0 Attachment
          --- In bang-phpug@yahoogroups.com, "vivekkimi" <vivekkimi@...> wrote:
          >
          > mysql_connect("localhost", "zzz", "zzz");
          > mysql_select_db("crawl"); // database name
          > $hosts=mysql_query("select * from xyz where kflag=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.
        • vivek sachi
          Hi, i tried after removing like from the SQL query but the problem remains.... Now my Query is just where name= $url ; please help me out with this as soon
          Message 4 of 8 , May 7 6:57 AM
          • 0 Attachment
            Hi,
            i tried after removing "like" from the SQL query but the problem remains....
            Now my Query is just "where name= $url";
            please help me out with this as soon as possible.





            ________________________________
            From: Dhruva Sagar <dhruva.sagar@...>
            To: bang-phpug@yahoogroups.com
            Sent: Thursday, 7 May, 2009 6:30:22 PM
            Subject: Re: [bang-phpug] help me!!!!





            The problem actually lies in the like %url% SQL syntax in my opinion.
            The like param is not very Database friendly, you should always avoid using
            it, see if you can work around using a 'like'

            On Thu, May 7, 2009 at 3:27 PM, vivekkimi <vivekkimi@yahoo. com> wrote:

            >
            >
            > mysql_connect( "localhost" , "zzz", "zzz");
            > mysql_select_ db("crawl" ); // database name
            > $hosts=mysql_ query("select * from xyz where kflag=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!*/
            >
            >
            >

            --
            Thanks & Regards,
            Dhruva Sagar.

            Ogden Nash <http://www.brainyqu ote.com/quotes/ authors/o/ ogden_nash. html> -
            "The trouble with a kitten is that when it grows up, it's always a cat."

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





            Explore your hobbies and interests. Go to http://in.promos.yahoo.com/groups/

            [Non-text portions of this message have been removed]
          • Koushik G raj
            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
            Message 5 of 8 , May 7 8:22 AM
            • 0 Attachment
              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@...> wrote:

              From: vivekkimi <vivekkimi@...>
              Subject: [bang-phpug] Re: help me!!!!
              To: bang-phpug@yahoogroups.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]
            • chittaranjan
              I am agree with Koushik. It will solve your problem. Thanks, Chitta (Zend Certified Engineer) ________________________________ From: Koushik G raj
              Message 6 of 8 , May 7 9:55 AM
              • 0 Attachment
                I am agree with Koushik.
                It will solve your problem.

                Thanks,
                Chitta
                (Zend Certified Engineer)




                ________________________________
                From: Koushik G raj <koushikgraj@...>
                To: bang-phpug@yahoogroups.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]





                Bollywood news, movie reviews, film trailers and more! Go to http://in.movies.yahoo.com/

                [Non-text portions of this message have been removed]
              • vivek sachi
                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
                Message 7 of 8 , May 7 8:19 PM
                • 0 Attachment
                  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@...>
                  To: bang-phpug@yahoogroups.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]
                • 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 8 of 8 , May 7 11:06 PM
                  • 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.