ALTER TABLE using phpmyadmin- an idiots guide?

Hi

I own a phpbb board and have been successfully adding modifications via phpmyadmin mainly through commands like INSERT and CREATE TABLE. I know nothing of SQL or PHP have just cautiously followed instuctions through online tutorials. Everythings worked so far, beginners luck maybe. Yet ive encountered a new command line im not sure how to do and thats ALTER TABLE.

Im told to:

ALTER TABLE phpbb_topics ADD topic_priority SMALLINT DEFAULT ‘0’ NOT NULL;

Ok please where do i go to insert this command? I hate clicking on stuff in phpmydmin in case i mess up but i cant seem to find this alter icon/button.

So please in phpmyadmin, after i select ‘phpbb_topics’ what do i click next to view the ALTER insertion field? also am i to copy and paste the whole command above into the table, even the ’ ’ around the 0 and the semi colon?

Then what do i press to execute?

Whether im given the answer or posted a link to tutorial (ive tried but cant seem to find an idiots step by step!) ill be grateful!

Ok thanks for listening guys

cheers

Neticus.

Hi there,


ALTER TABLE phpbb_topics ADD topic_priority SMALLINT DEFAULT '0' NOT NULL;

Is an SQL query statement. This tells your MySQL database to

ALTER the TABLE “phpbb_topics” and ADD “topic_priority” column with the data type as SMALLINT and a DEFAULT value of ‘0’ this field will NOT accept NULLS and will assign the default value if it ever encounters a NULL value…

how do you execute this query?

  • click your phpbb table from the left side navigation
  • click the “SQL” link on the page in the main frame. (it’s the second link next to “structure” link)
  • a text area will be displayed with a small message “Run SQL query/queries on database” above it. *
  • copy and paste the SQL query statement “ALTER TABLE phpbb_topics ADD topic_priority SMALLINT DEFAULT ‘0’ NOT NULL;” into the text area

  • click “go” button.

NB: You should ALWAYS backup your database before doing any modifications so then if it does not work, you can always drop the failed database tables and import the version that you had before you started making your latest mods.

good luck,

Melan’

Thanks for taking the time to explain Melan’!

Im going to try it and yes backup the database prior to!

Peace

Neticus.

melancholic,

as a further to Neticus’ post I’ve been given the information on a table that I have to alter. They’ve added a twist to it and I’d like to be sure that I do it correctly. Here’s what I’ve been told to do:
Remember to change the table prefix used on your database
INSERT INTO phpbb_config ( config_name , config_value ) VALUES ( ‘notify_admin_new_reg’, ‘1’ );
INSERT INTO phpbb_config ( config_name , config_value ) VALUES ( ‘notify_admin_new_reg_userid’, ‘2’ );

I understand what you’ve said about executing the sql query and adding the file into the info box, but where the instructions say to “change the table prefix” I’m lost. Can you help? Thanks in advance

DougB

DougB from my understanding they are reffering to the ‘phpbb_config’ bit. If in your database phpbb_config is labelled as phpbb_config then there is no need to change your prefix, the prefix being ‘phpbb’. Yet if your Phpbb_config is labelled as for e.g. phpbbDougB_config then you would need to change the above code as INSERT INTO phpbbDougB_config ( config_name , … etc etc.

Im pretty sure this is what they mean. But after installation I guess you’ll know if its working or not by registering a ‘test’ user to see if you get notified.

Ok Goodluck,
Neticus

Hi there,

What Neticus says is right with regards to phpbb being the default prefix.

IF you had not changed the name, then it should be alright to run the queries.

If you have changed the name of the table prefix (“phpbb_”) to something else (like in neticus’ example - “phpbbDougB_”), then you’ll need to run those queries with the correct table names.

Ya see,

You goes to where the knowledge is at and you get good answers. Absolutely correct gentlemen both. I couldn’t figure out why they were telling me to change the prefix however (it wasn’t necessary!) Thanks Guys!!!

DougB