How to add a Default value for a specific column or field value

Discussion in 'PHP' started by Amar505, Dec 14, 2013.

  1. #1
    Here I have to create a table with id as auto increment and remaining fileds ike name,adddress,phone number,city,country,cost.code and also Status....


    Initially I want to create a table with Auto incremented ID as Primary key and Status filed with Default values like No
    for all Iterations..

    Can you please provide the Query

    and when we click on SUbmit button it should store all in single table How?????
     
    Solved! View solution.
    Amar505, Dec 14, 2013 IP
  2. #2
    ThePHPMaster, Dec 14, 2013 IP
  3. Amar505

    Amar505 Greenhorn

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #3
    Hello Sir,,, I am not clear
    Create Table: CREATE TABLE t (
    id INT(11) default NULL auto_increment,

    s char(60) default NULL,/* Here I dont want to use Default value as NULL I want to get All column filed values as "NO".

    PRIMARY KEY (id)
    )
     
    Amar505, Dec 14, 2013 IP
  4. scintillescent_dude

    scintillescent_dude Greenhorn

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #4
    Ans: s char(60) default NOT NULL DEFAULT 'No',
     
    scintillescent_dude, Dec 14, 2013 IP
  5. Amar505

    Amar505 Greenhorn

    Messages:
    25
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    21
    #5
    Hello Thanks for your reply Dude.....
    My question... My database is structures as shown in the below figure.

    Check the Image clearly or else You won't understand Plzzzzzz

    For clear information
    FIrst I create label and then Text Box and also a button.
    Whenever I Entered the PRimary Key ID in the text box and Whenever I clcik on Button It should change its status to YES.

    and also How to retrieve the Staus WHenever I Type the Primary KEY ID ..

    I create the table using AUTOIncrement and also I set the Status Filed value as default NO.

    My 2 Doubts... are
    1.how to update the Status filed status to YES
    FIrst I create label and then Text Box and also a button.
    Whenever I Entered the PRimary Key ID in the text box and Whenever I clcik on Button It should change its status to YES.

    ID 12
    button
    Whenever I click on Button Staus should set status filed value to Yes for the Primary KEY ID.It is public not restricted.



    2.How to display the staus whenever I Type on the Primary KEY ID

    Same to Same.

    FIrst I create label and then Text Box and also a button.
    Whenever I Entered the PRimary Key ID in the text box and Whenever I click on Button It should display status

    ID 12
    button
    It should display staus as YES or NO ..How Plzz Help m...e
     

    Attached Files:

    Amar505, Dec 15, 2013 IP