1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

How to mass update phpmyadmin cells?

Discussion in 'PHP' started by Mkcoy, Dec 5, 2014.

  1. #1
    So I have lots of cells or tables w/e their called idk Im no php expert!

    In some of them are urls like http://www. site.com/something-here

    All I want to do is remove the www. part from them all.

    How can I do that?

    Thanks!
     
    Mkcoy, Dec 5, 2014 IP
  2. kcitywd

    kcitywd Member

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #2
    Download your MySQL db as SQL file. Open them with notepad and replace the text. Then import those SQL file.
     
    kcitywd, Dec 5, 2014 IP
  3. Mkcoy

    Mkcoy Well-Known Member

    Messages:
    1,602
    Likes Received:
    77
    Best Answers:
    2
    Trophy Points:
    195
    #3
    Hi @ kcitywd I see where you're going but its a bit more complicated than that I think? Replace what text do you mean?
    I need to import only certain things from the database and convert others into something else like the category number into a WP category and the url structure (slug) also.

    There's like 11 bits of data I need to import/convert and map
    `games` (`ID`, `title`, `url`, `swf`, `thumb`, `description`, `category`, `width`, `height`, `cheat`, `views`, `code`)

    If I can just get the basics like title, url, swf, thumb, desc, cat, width and height, cheat, views and code (game code/embed code) into a post all mapped correctly with the files showing correctly that will be a start.

    Cheers!
     
    Mkcoy, Dec 5, 2014 IP
  4. kcitywd

    kcitywd Member

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #4
    You will need to understand http://codex.wordpress.org/Taxonomies for customizing the url structure. Maybe your developer has created some custom post for "games". You will need some custom coding for that.
     
    kcitywd, Dec 5, 2014 IP
  5. Mkcoy

    Mkcoy Well-Known Member

    Messages:
    1,602
    Likes Received:
    77
    Best Answers:
    2
    Trophy Points:
    195
    #5
    Oh yeah '/category/name' for category number conversion etc. Got it cheers. Yeah I have got someone on it now says he can do it just needs to add some custom fields in wp and hopefully use of several plugins for redirection etc and should be able to get it standing at least.
    Cheers.
     
    Mkcoy, Dec 5, 2014 IP
  6. PoPSiCLe

    PoPSiCLe Illustrious Member

    Messages:
    4,623
    Likes Received:
    725
    Best Answers:
    152
    Trophy Points:
    470
    #6
    I'm still a little unsure what you need, but if these are all stored in a database, why not just fetch them, and strip away the values / replace values as you use the fetched rows? If, for instance, you want to strip out www from each url (and only that), and perhaps also just for internal links, if there might also be external links, you could do something like this:
    
    $url = 'http://somedomain.com/this-is-a-post';
    $tempurl = explode('http://www.',$url);
    $tempurl[0] = ($tempurl[0] == '') ? 'http://' : $url;
    
    echo join('',$tempurl);
    
    Code (markup):
    Could perhaps be condensed more...
    As I said, still unsure what you really need to do, but changing specific values (or, rather, avoid using parts of a string), can just as easily be adjusted on the return values, as in the database. Btw, why in the world do you want to skip the www-part of the domain? Any specific reason for that?
     
    PoPSiCLe, Dec 5, 2014 IP
  7. kcitywd

    kcitywd Member

    Messages:
    21
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    31
    #7
    Thank you Mkcoy. Have a good day.
     
    kcitywd, Dec 5, 2014 IP
  8. Mkcoy

    Mkcoy Well-Known Member

    Messages:
    1,602
    Likes Received:
    77
    Best Answers:
    2
    Trophy Points:
    195
    #8
    @ popsicle it is okay. I have got my threads mixed up not properly looking at what Im doing thought I was posting in my earlier thread :p
    I've managed to do that now the www thing. My colleagues wanted it to be like that as he wasnt using that version on his site and his WMT was giving him some weird 301 error message.
    He also took some dip in ranks and traffic/earnings so it could obviously be related as happened at same time.
    Now he wants to migrate to WP which should sort out his sitemap issues and the 301 error too. Fingers crossed.

    Cheers!

    Mike.
     
    Mkcoy, Dec 5, 2014 IP
  9. freelanceDeveloper

    freelanceDeveloper Member

    Messages:
    59
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    43
    #9
    update tableX set URLFIELDY=REPLACE(URLFIELDY, 'www.','')
     
    freelanceDeveloper, Dec 9, 2014 IP
    ThePHPMaster likes this.
  10. Mkcoy

    Mkcoy Well-Known Member

    Messages:
    1,602
    Likes Received:
    77
    Best Answers:
    2
    Trophy Points:
    195
    #10
    Yeah, good one. That helps LOL
     
    Mkcoy, Dec 9, 2014 IP