Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Jun 2002
Posts: 670
Code Monkey
Code Monkey
Offline
Joined: Jun 2002
Posts: 670
Ok. It is in the 'photos' table of my database where I'll need the command. The two fields that will be used in the command are 'cat' and 'title'.

What I want to do is to be able to rename the title for every single photo from a certain category.

For example, I want all photos from that have 'cat' as 504 to have a new 'title' that is: 'Adamari López'

If any one can give me the generic command using 5xx for the category number and XXXXXX as the new title for ALL the photos in the category (this way I can just reuse the command for all the categories by changing the cat number and putting in different titles). I would appreciate any help. BTW, my PhotoPost database does not have a prefix for the tables.

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Backup your Database first, but this should do it:

UPDATE photos
SET title = 'XXXXXXXXX'
WHERE cat = 504



Joined: Jun 2002
Posts: 670
Code Monkey
Code Monkey
Offline
Joined: Jun 2002
Posts: 670
Do I have to put the new title between single quotes?
EDIT: I thought about it and obviously I need to use the quotes. Thanks, Josh! It worked!

Last edited by donJulio; 10/29/2003 1:25 AM.
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yes, but the category number - quotes are optional (as it can handle a number without quotes.)


Joined: Jun 2002
Posts: 670
Code Monkey
Code Monkey
Offline
Joined: Jun 2002
Posts: 670
This works well, except now I am up to almost 40 galleries, and this can get tedious. Since PhotoPost and Threads are using the same database, I'll really appreciate the ability to save SQL commands that comes with 6.4. But I have, hopefully, a better idea.

Is there a SQL command that can be used to rename the title of every single photo to make it the same as the name of the category they appear in, w/o doing this one category at a time? If so, that would be very useful.

Sponsored Links
Joined: Apr 2001
Posts: 3,266
Member
Member
Offline
Joined: Apr 2001
Posts: 3,266
Nope no easy way you would have to set it one cat at a time.


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Gizmo
Gizmo
Portland, OR, USA
Posts: 5,833
Joined: January 2000
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20221218)