Greetings everyone
i'm working on small project on php and MySQL and i just start to learn them
i write a code that allow me to add new field in my table with default value but i wanted to ask can i make the field added to the table with default value but for the records with value '1' in the previous field it add other value
e.i
my table contain
names 1/1/2011 "the new field that the code will add"
john 1 A
mark 0 P
kate 1 A
so if the previous field have 1 it will add A as default value if it have 0 it will add P as default value
my code
<?php
$host="localhost";
$username="root";
$password="";
$db_name="el";
mysql_connect("$host", "$username", "$password")or die("cannot connect");
mysql_select_db("$db_name")or die("DB not found");
$myusername=$_POST['myusername'];
$datf= gmdate(DATE_RFC822);
@mysql_query("ALTER TABLE `attendace_info_old` ADD `$datf` varchar(255)DEFAULT 'A'") or die(mysql_error());
?>
so
i want to add only one field this field will be filled automatically so if the previous field record contain 0 it will be filled as A if it contain 1 it will be filled as P
hope there are a way to make this because i finished everything only this step still for me