Need SQL help

airbornflghtairbornflght Houston, TX Icrontian
edited April 2008 in Internet & Media
Ok, so I messed up my joomla install by trying to install an SEO patch via file overwrites. I followed the directions exactly yet the backend still got all messed up. So I tried putting the files back and that didn't work. Anyway, long story short, I got smart and just replace the entire administrator folder, but only after trying to do a new install and pointing it at the old database.

So now my database has a set of tables with the prefix jos_ and a set with bak_. Now the bak_ ones are my old site and the jos_ ones are the 'new' content the installer made.

So how would I write an sql or php script to delete all of the jos_ tables and rename the bak_xxxx tables to jos_xxxx? I'm about to shoot myself. especially since I didn't backup.

this is semi-urgent as I have someone from nationals checking out the site in the morning. and I'd rather him not look at a blank page

Comments

  • LincLinc Owner Detroit Icrontian
    edited April 2008
    Dude, you need phpmyadmin. This is all a matter of point-and-click with that.

    Nuke each table:
    DROP  TABLE 'tablename'  ;
    
    Rename each table:
    RENAME  TABLE 'dbname'.'tablename'  TO 'dbname'.'tablename_new' ;
    

    Just do it one at a time. Writing a pattern-matching PHP file is just going to make this all more prone to disaster. And get phpmyadmin. It makes this all simple and you can learn the SQL from it.
  • kryystkryyst Ontario, Canada
    edited April 2008
    I can't help with your problem. I can only say this

    Dude - what where you thinking?

    Always *ALWAYS* backup before you start messing around with that stuff. Furthermore, why would you do it now if you kinda needed it up and running for nationals.

    I say this not to be mean, but to point it out with a halo in hopes that you have learned from this make.


    P.S. I've been in a similar state before, I've banged my head off the wall enough times to learn the lessons the hard way. Welcome to the club.
  • airbornflghtairbornflght Houston, TX Icrontian
    edited April 2008
    Well, it all seemed bullet proof at the time.....


    I'm just glad to have joomla functioning again. the backed was fubar.

    Oh yeh, I have phpmyadmin. I know I can select all those tables and drop them, I'm sure there isn't anyway to point and click to rename them is there?

    Inside the sql tab phpmyadmin would I type:
    RENAME  'bak_tablename'  TO 'jos_tablename' ;
    

    since I will already be accessing that database. I just dropped all the jos_ tables.
  • airbornflghtairbornflght Houston, TX Icrontian
    edited April 2008
    well. I got the tables all renamed through a little help from excel. now the content is back on the site. but the back end is still having problems....
  • airbornflghtairbornflght Houston, TX Icrontian
    edited April 2008
    Situation Resolved..:)
Sign In or Register to comment.