|
Joined: Jun 2002
Posts: 670
Code Monkey
|
Code Monkey
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.
|
|
|
|
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
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
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.
|
|
|
|
Joined: Apr 2001
Posts: 3,266
Member
|
Member
Joined: Apr 2001
Posts: 3,266 |
Nope no easy way you would have to set it one cat at a time.
|
|
|
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.
|
|
Posts: 5,834
Joined: January 2000
|
|
Forums63
Topics37,575
Posts293,931
Members13,824
|
Most Online6,139 Sep 21st, 2024
|
|
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
|
|
|
|