>>MySQL QUEEERY help yo

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • juicylinks
    So Fucking Banned
    • Apr 2001
    • 122992

    #1

    >>MySQL QUEEERY help yo

    Check it out

    I got galleries in a table

    jg_galleries

    in that table the main domain url is domainA.com

    Can i so some fancy sql shit to replace doaminA.com with domainB.com in one queeeeery?


  • grumpy
    Too lazy to set a custom title
    • Jan 2002
    • 9870

    #2
    update table set fieldname="something" where fieldname="something"
    Don't let greediness blur your vision | You gotta let some shit slide
    icq - 441-456-888

    Comment

    • juicylinks
      So Fucking Banned
      • Apr 2001
      • 122992

      #3

      Comment

      • creegan
        Confirmed User
        • Jun 2004
        • 223

        #4
        why not do it after the query, like as you're looping stuff out

        $string=str_replace("domainA.com", "domainB.com", "$query_result");
        gfy'ers remind me of the causeheads from pcu

        Comment

        • pornstar2pac
          Omaha Hi/Lo
          • Nov 2003
          • 17380

          #5
          If you go 7-11 today, bring me back some slim jims.


          and some pop rocks
          Trump haters gonna hate. that's all they can do

          Comment

          • Viper2K1
            Confirmed User
            • Aug 2001
            • 1006

            #6
            update jg_galleries SET fieldyouuseforthedomain="
            domainB.com" where fieldyouuseforthedomain="domainA.com";
            Spank me
            Dude, where's my traffic?

            Comment

            • creegan
              Confirmed User
              • Jun 2004
              • 223

              #7
              or you could do update, i figured that domaina.com was in the db for a reason though
              gfy'ers remind me of the causeheads from pcu

              Comment

              • juicylinks
                So Fucking Banned
                • Apr 2001
                • 122992

                #8
                cool cool

                Let me back up the db then try thanks for the help

                Comment

                • grumpy
                  Too lazy to set a custom title
                  • Jan 2002
                  • 9870

                  #9
                  Originally posted by Viper2K1
                  update jg_galleries SET fieldyouuseforthedomain="
                  domainB.com" where fieldyouuseforthedomain="domainA.com";

                  Thats what i said :-)
                  Don't let greediness blur your vision | You gotta let some shit slide
                  icq - 441-456-888

                  Comment

                  • Viper2K1
                    Confirmed User
                    • Aug 2001
                    • 1006

                    #10
                    Originally posted by grumpy
                    Thats what i said :-)
                    saw that after i made my post, i type kinda sloooow hehe
                    Spank me
                    Dude, where's my traffic?

                    Comment

                    • Due
                      Confirmed User
                      • Mar 2001
                      • 3620

                      #11
                      This might be what you are looking for:

                      $searching="FIND-THIS";
                      $replace="REPLACE-WITH-THIS";

                      $res = mysql_query("SELECT * FROM jg_galleries WHERE url LIKE '%$searching%'");
                      while($row = mysql_fetch_array($res)) {
                      $surl++;
                      $my_id[$surl] = $row[id];
                      $my_thumb[$surl] = $row[url];
                      }

                      while($y<$surl){
                      $y++;
                      $newurl[$y]=str_replace("$searching", "$replace", $my_thumb[$y]);
                      $query = mysql_query("UPDATE jg_galleries SET url='$newurl[$y]' WHERE id='$my_id[$y]'") or print mysql_error();
                      }
                      I buy plugs
                      Skype: Due_Global
                      /Due

                      Comment

                      • Due
                        Confirmed User
                        • Mar 2001
                        • 3620

                        #12
                        replace { with the opening of character for }
                        I buy plugs
                        Skype: Due_Global
                        /Due

                        Comment

                        • woj
                          <&(©¿©)&>
                          • Jul 2002
                          • 47882

                          #13
                          Originally posted by Due
                          This might be what you are looking for:

                          $searching="FIND-THIS";
                          $replace="REPLACE-WITH-THIS";

                          $res = mysql_query("SELECT * FROM jg_galleries WHERE url LIKE '%$searching%'");
                          while($row = mysql_fetch_array($res)) {
                          $surl++;
                          $my_id[$surl] = $row[id];
                          $my_thumb[$surl] = $row[url];
                          }

                          while($y<$surl){
                          $y++;
                          $newurl[$y]=str_replace("$searching", "$replace", $my_thumb[$y]);
                          $query = mysql_query("UPDATE jg_galleries SET url='$newurl[$y]' WHERE id='$my_id[$y]'") or print mysql_error();
                          }
                          there is NO reason at all to do this, when a simple
                          "UPDATE x SET y WHERE z" query will do just as well...
                          Custom Software Development, email: woj#at#wojfun#.#com to discuss details or skype: wojl2000 or gchat: wojfun or telegram: wojl2000
                          Affiliate program tools: Hosted Galleries Manager Banner Manager Video Manager
                          Wordpress Affiliate Plugin Pic/Movie of the Day Fansign Generator Zip Manager

                          Comment

                          • JSA Matt
                            So Fucking Banned
                            • Aug 2003
                            • 5464

                            #14
                            Did you solve this yet? What do the entries look like?

                            Are they like:
                            http://www.domainA.com/

                            or more like

                            http://www.domainA.com/gallery1/index.html

                            ?

                            Comment

                            • Due
                              Confirmed User
                              • Mar 2001
                              • 3620

                              #15
                              Originally posted by woj
                              there is NO reason at all to do this, when a simple
                              "UPDATE x SET y WHERE z" query will do just as well...
                              Actually there is.
                              Else "y/gallery/whatever/213423.html" will just be replaced with "x" when it should have been "x/gallery/whatever/213423.html"
                              I asume he have 100's or 1000's of galleries saved on 1 domain that need to be updated to be on another domain.
                              I buy plugs
                              Skype: Due_Global
                              /Due

                              Comment

                              • juicylinks
                                So Fucking Banned
                                • Apr 2001
                                • 122992

                                #16
                                Originally posted by JSA Matt
                                Did you solve this yet? What do the entries look like?

                                Are they like:
                                http://www.domainA.com/

                                or more like

                                http://www.domainA.com/gallery1/index.html

                                ?
                                like this

                                http://www.domainA.com/gallery1/index.html

                                Comment

                                • creegan
                                  Confirmed User
                                  • Jun 2004
                                  • 223

                                  #17
                                  Originally posted by woj
                                  there is NO reason at all to do this, when a simple
                                  "UPDATE x SET y WHERE z" query will do just as well...
                                  unless you plan on expanding your affiliate program with more sites and more hosted galleries, and need to generate the data on the fly
                                  gfy'ers remind me of the causeheads from pcu

                                  Comment

                                  • M_M
                                    Confirmed User
                                    • May 2004
                                    • 1167

                                    #18
                                    Originally posted by Due
                                    Actually there is.
                                    Else "y/gallery/whatever/213423.html" will just be replaced with "x" when it should have been "x/gallery/whatever/213423.html"
                                    I asume he have 100's or 1000's of galleries saved on 1 domain that need to be updated to be on another domain.

                                    UPDATE tablename SET fieldname = REPLACE(fieldname,'domainA','domainB')


                                    u gotta study more my man
                                    ;-)!;-)!;-)!;-)!;-)!;-)!;-)!;-)!;-)!;-)!;-)

                                    Comment

                                    • Due
                                      Confirmed User
                                      • Mar 2001
                                      • 3620

                                      #19
                                      Originally posted by M_M
                                      UPDATE tablename SET fieldname = REPLACE(fieldname,'domainA','domainB')


                                      u gotta study more my man
                                      Well I just posted a search and replace script I made a few months ago.
                                      Got nothing to do with if I need to study more or not.
                                      The original search and replace script contained a lot more functions that included updating other tables for some of the results depending on what was returned from the first result.
                                      So a simple replace wouldn't be good enough for what I needed it for.
                                      I buy plugs
                                      Skype: Due_Global
                                      /Due

                                      Comment

                                      • SlickCash Sarah
                                        Confirmed User
                                        • Feb 2004
                                        • 2055

                                        #20
                                        This thread reminds me of this..


                                        asdlfkjasd;lfhspdfhglgpoighgpowigwekjhwoeigjkwe

                                        Like Chinese to me.

                                        Comment

                                        • M_M
                                          Confirmed User
                                          • May 2004
                                          • 1167

                                          #21
                                          Originally posted by Due
                                          Well I just posted a search and replace script I made a few months ago.
                                          Got nothing to do with if I need to study more or not.
                                          The original search and replace script contained a lot more functions that included updating other tables for some of the results depending on what was returned from the first result.
                                          So a simple replace wouldn't be good enough for what I needed it for.
                                          excuses, excuses


                                          j/k
                                          ;-)!;-)!;-)!;-)!;-)!;-)!;-)!;-)!;-)!;-)!;-)

                                          Comment

                                          • fusionx
                                            Confirmed User
                                            • Nov 2003
                                            • 4618

                                            #22
                                            Originally posted by M_M
                                            UPDATE tablename SET fieldname = REPLACE(fieldname,'domainA','domainB')
                                            Assuming the DB is mySql, which it probably is

                                            Comment

                                            • Tom_PMs
                                              Confirmed User
                                              • Jun 2004
                                              • 2049

                                              #23
                                              Oh then Sarah, you'll appreciate this actual copy and paste from Perl documents.

                                              If you fork without ever waiting on your children, you will accumulate zombies.

                                              My favorite!

                                              You've read it, you can't unread it.

                                              Comment

                                              Working...