SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    Lexington, KY
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    In need of a query

    I have a Wordpress blog running on a MySQL database and I'd like to add a custom field with a key name of "googlead" and a value of "1".

    Can someone give me a hand on a query that will add this custom field to all 425 posts on my blog?

  2. #2
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    To add a field to a table, read this: http://dev.mysql.com/doc/refman/5.1/en/alter-table.html

  3. #3
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    Lexington, KY
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    guido,

    Thanks for the link - any chance you have one that's in plain english? I don't know the first thing about MySQL or running queries. :\

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    do you have access to a GUI tool like phpmyadmin? it's pretty self-explanatory for simple operations like adding a column to a table.
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  5. #5
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    What table do you want to add the field to?
    What do you need this field for? Do you have to change some Wordpress PHP script as well?

  6. #6
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    Lexington, KY
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by longneck View Post
    do you have access to a GUI tool like phpmyadmin? it's pretty self-explanatory for simple operations like adding a column to a table.
    Yes I do have phpmyadmin on my server.


    Quote Originally Posted by guido2004 View Post
    What table do you want to add the field to?
    What do you need this field for? Do you have to change some Wordpress PHP script as well?
    Custom fields are stored in the postmeta table on wordpress installs. No changes in php files are needed.

  7. #7
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    Quote Originally Posted by WoodiE55 View Post
    Yes I do have phpmyadmin on my server.
    Start PHPMyAdmin, open the database, open the structure view of the postmeta table, and look for a button that says 'add field' or something like that.

  8. #8
    SitePoint Evangelist
    Join Date
    Apr 2003
    Location
    Lexington, KY
    Posts
    439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by guido2004 View Post
    Start PHPMyAdmin, open the database, open the structure view of the postmeta table, and look for a button that says 'add field' or something like that.
    It's not just adding a field to the one table. This needs to be added to each post entry. This doesn't work.

  9. #9
    From Italy with love silver trophybronze trophy
    guido2004's Avatar
    Join Date
    Sep 2004
    Posts
    9,510
    Mentioned
    163 Post(s)
    Tagged
    4 Thread(s)
    well, it's a start
    Once you have the new field, do you have to put the value '1' in all rows, or in specific rows?


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •