Your HostICan Community  


Go Back   Your HostICan Community > Programming & Design > PHP / MySQL Assistance

PHP / MySQL Assistance We understand. Not all of you are experienced programmers, but some of you are highly skilled at coding. So we've set aside this forum so you can ask questions, and provide answers to the most commonly asked PHP / MySQL issues.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-04-2009, 01:15 PM
Mr.X-PAS Mr.X-PAS is offline
Junior Member
 
Join Date: Apr 2009
Posts: 2
Default adding field

For some reason I need to add one more field in my DB. I have a shell access, a MySQL, only not know what exactly is the command in MySQL mode, because I am not skilled in MySQL.

Best Regards
Reply With Quote
  #2  
Old 04-05-2009, 12:39 PM
cech's Avatar
cech cech is offline
Member
 
Join Date: Feb 2009
Posts: 83
Default Re: adding field

If you want to add each time one field in a table, use the following command:
Code:
mysql> alter table tablename add column columname char(10);
Where char(10) meant max number of character in field.
After commit the command line will dee notification lines:
Code:
Query OK, 1 row affected (0.04 sec)
Records: 1  Duplicates: 0  Warnings: 0
Reply With Quote
  #3  
Old 04-06-2009, 08:18 AM
Mr.X-PAS Mr.X-PAS is offline
Junior Member
 
Join Date: Apr 2009
Posts: 2
Default Re: adding field

My table consists of several fields. How to add all their fields at time? After all this I want to be sure that everything is OK.
Reply With Quote
  #4  
Old 04-06-2009, 10:47 AM
cech's Avatar
cech cech is offline
Member
 
Join Date: Feb 2009
Posts: 83
Default Re: adding field

Anytime you can see the contents of your table. In mysql command line type:
Code:
select * from yourtable;
There is a good example for multiply add columns:
Code:
alter table tablename add column columname1 datatype,add column columname2 datatype,add column columname3 datatype, add column columname4 datatype;
Where datatype can be:
Code:
TINYINT; SMALLINT; MEDIUMINT; INT; BIGINT; FLOAT; DOUBLE; DECIMAL; NUMERIC; DATE; DATETIME; TIMESTAMP; TIME; YEAR; CHAR; VARCHAR; TINYBLOB; TINYTEXTM; BLOB; TEXT; MEDIUMBLOB; MEDIUMTEXT; LONGBLOB; LONGTEXT
Do not forget, you can do this through SSH directly in mysql command line, or using phpMyAdmin Run SQL query/queries link.
Reply With Quote
Reply

Tags
adding, field

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT -4. The time now is 03:08 PM.


Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.

Copyright © 2003 - 2008 HostICan. All Rights Reserved.