PHP MySQL: Editing Field Table

php mysql basic step by step tutorial - part 16: In one time, sometime the table that you have been made need some modification or changes. For example, the previous field type of char wants to change into varchar or the previous field length of char (50) wants to be widened become char (100). To change these field, you can use this syntax:

ALTER TABLE table_name MODIFY field_name field_type field_attribute

Example, we will change the field type of the data_employees table field position into char (50):

//the example of changing MySQL database field table

//database connection

$order1 = "ALTER TABLE data_employees MODIFY position char(50)";
$add_field = mysql_db_query("employees", $order1);
if ($add_field){
	echo ("<br><br>Field position succeeds in adding");
	echo ("<br><br>Field position fails in adding");

Series this article:
PHP MySQL: Connecting to Database Use mysql_connect()
PHP MySQL: Making Database Use mysql_create_db()
PHP MySQL: Making Table
PHP MySQL: The Data Type of Field
PHP MySQL: Char and Varchar Data Type
PHP MySQL: Data Type of Date
PHP MySQL: MySQL Syntax Orders
PHP MySQL: Inserting Data
PHP MySQL: Creating Form Insert Data
PHP MySQL: Display Data
PHP MySQL: mysql_fetch_row() Function
PHP MySQL: mysql_fetch_array() Function
PHP MySQL: Editing data
PHP MySQL: Deleting data
PHP MySQL: Adding Field Table
PHP MySQL: Editing Field Table
PHP MySQL: Deleting Field Table

Bookmark and Share Tag: mysql, database, field, edit Category: PHP Database Post : March 03rd 2008 Read: 65,488


blog comments powered by Disqus