Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-16-2004, 10:22 AM   #1
Juicy D. Links
So Fucking Banned
 
Industry Role:
Join Date: Apr 2001
Location: N.Y. -Long Island --
Posts: 122,992
>>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?


Juicy D. Links is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:24 AM   #2
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
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
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:24 AM   #3
Juicy D. Links
So Fucking Banned
 
Industry Role:
Join Date: Apr 2001
Location: N.Y. -Long Island --
Posts: 122,992
Juicy D. Links is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:25 AM   #4
creegan
Confirmed User
 
Join Date: Jun 2004
Posts: 223
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
creegan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:25 AM   #5
pornstar2pac
Omaha Hi/Lo
 
Join Date: Nov 2003
Posts: 17,380
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
pornstar2pac is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:25 AM   #6
Viper2K1
Confirmed User
 
Industry Role:
Join Date: Aug 2001
Posts: 1,006
update jg_galleries SET fieldyouuseforthedomain="
domainB.com" where fieldyouuseforthedomain="domainA.com";
__________________
Spank me
Dude, where's my traffic?
Viper2K1 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:26 AM   #7
creegan
Confirmed User
 
Join Date: Jun 2004
Posts: 223
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
creegan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:27 AM   #8
Juicy D. Links
So Fucking Banned
 
Industry Role:
Join Date: Apr 2001
Location: N.Y. -Long Island --
Posts: 122,992
cool cool

Let me back up the db then try thanks for the help
Juicy D. Links is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:28 AM   #9
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
Quote:
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
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:38 AM   #10
Viper2K1
Confirmed User
 
Industry Role:
Join Date: Aug 2001
Posts: 1,006
Quote:
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?
Viper2K1 is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:54 AM   #11
Due
Confirmed User
 
Due's Avatar
 
Industry Role:
Join Date: Mar 2001
Location: Murrieta, CA
Posts: 3,620
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
Due is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 10:56 AM   #12
Due
Confirmed User
 
Due's Avatar
 
Industry Role:
Join Date: Mar 2001
Location: Murrieta, CA
Posts: 3,620
replace { with the opening of character for }
__________________
I buy plugs
Skype: Due_Global
/Due
Due is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 11:58 AM   #13
woj
<&(©¿©)&>
 
woj's Avatar
 
Industry Role:
Join Date: Jul 2002
Location: Chicago
Posts: 47,882
Quote:
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
woj is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 12:01 PM   #14
JSA Matt
So Fucking Banned
 
Join Date: Aug 2003
Location: San Diego, CA
Posts: 5,464
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

?
JSA Matt is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 01:52 PM   #15
Due
Confirmed User
 
Due's Avatar
 
Industry Role:
Join Date: Mar 2001
Location: Murrieta, CA
Posts: 3,620
Quote:
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
Due is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 01:59 PM   #16
Juicy D. Links
So Fucking Banned
 
Industry Role:
Join Date: Apr 2001
Location: N.Y. -Long Island --
Posts: 122,992
Quote:
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
Juicy D. Links is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 02:02 PM   #17
creegan
Confirmed User
 
Join Date: Jun 2004
Posts: 223
Quote:
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
creegan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 02:03 PM   #18
M_M
Confirmed User
 
Join Date: May 2004
Posts: 1,167
Quote:
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
M_M is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 02:44 PM   #19
Due
Confirmed User
 
Due's Avatar
 
Industry Role:
Join Date: Mar 2001
Location: Murrieta, CA
Posts: 3,620
Quote:
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
Due is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 02:45 PM   #20
SlickCash Sarah
Confirmed User
 
Join Date: Feb 2004
Location: Toronto-I would rather DIE of thirst, then drink from the cup of MEDIOCRITY!
Posts: 2,055
This thread reminds me of this..


asdlfkjasd;lfhspdfhglgpoighgpowigwekjhwoeigjkwe

Like Chinese to me.
SlickCash Sarah is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 02:46 PM   #21
M_M
Confirmed User
 
Join Date: May 2004
Posts: 1,167
Quote:
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
M_M is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 02:48 PM   #22
fusionx
Confirmed User
 
Industry Role:
Join Date: Nov 2003
Location: Olongapo City, Philippines
Posts: 4,618
Quote:
Originally posted by M_M
UPDATE tablename SET fieldname = REPLACE(fieldname,'domainA','domainB')
Assuming the DB is mySql, which it probably is
fusionx is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-16-2004, 02:50 PM   #23
Tom_PMs
Confirmed User
 
Join Date: Jun 2004
Posts: 2,049
Oh then Sarah, you'll appreciate this actual copy and paste from Perl documents.

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

My favorite!
__________________

You've read it, you can't unread it.
Tom_PMs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.