 specify that it should hold null when creating it, like this:
CREATE TABLE `table` (
id INT NOT NULL AUTO_INCREMENT,
date DATE NULL DEFAULT NULL,
PRIMARY KEY(id)
)

It is also very important that you perform the query with bound parameters, for example using pdo

http://www.php.net/manual/en/pdo.construct.php
http://php.net/manual/en/pdo.prepared-statements.php
How do I insert NULL values using PDO?

Something like this:
$query = 'INSERT INTO table (column_s1, column_s2, column_d1, column_d2)
VALUES (?,?,?,?)';
$stmt = $db->prepare($query);
$stmt->execute(array($string1,$string2,$date1,$date2));

 Q:

Java Creating an Instance of a Object

I am trying to create 2 classes. 
The first is called cellar with this I haven't had any problems:
class Cellar{   
    private String Name_Cellar;
    private String D_O;

    public String toString(){String values= Name_Cellar +" "+ D_O;return values;}

    public Cellar(String NameCellar, String DO) {
        this.Name_Cellar= NameCellar;
        this.D_O= DO;
    }
    public void setName(String NameCellar) {this.Name_Cellar= NameCellar;}
    public String getName() {return Name_Cellar;}

    public void setDO (String DO) {this.D_O = DO;}
    public String getDO() {return D_O;}
}

The problem begins in the second class:
class Wines{

    private String Name_Wine;
    private Cellar Fabricant;
    private String Type;
    private float Grad_Alch;
    private int Date;
}

Fabricant must be an instance of object type Cellar.
How could i do it?
Thank you in advance guys!

A:

Indeed you've done it correctly in your code.
private Cellar Fabricant;//Definition
//...
Fab
specify that it should hold null when creating it, like this: 
 CREATE mesa 'mesa '(
 i d INT NOT NULL AUTO_INCREMENT, 
 date DATE NULL DEFAULT NULL, 
 PRIMARY KEY(id) 
) 

 It is also very important that you do the query with bound parameters, for model using pdo 

 http://www.php.net/manual/en/pdo.construct.php 
 http://php.net/manual/en/pdo.prepared-statements.php 
 How do I insert NULL value using PDO? 

 Something like this: 
 $ query =' slip in INTO table (column_s1, column_s2, column_d1, column_d2) 
 VALUES (?, ?, ?, ?)'; 
 $ stmt = $ db->prepare($query); 
 $ stmt->execute(array($string1,$string2,$date1,$date2) ); 

  Q: 

 Java Creating an Instance of a aim 

 I am trying to create 2 classes. 
 The first is called cellar with this I haven't had any problems: 
 course Cellar {   
     private String Name_Cellar; 
     private String D_O; 

     public String toString(){String values= Name_Cellar + " " + D_O;return value; } 

     public Cellar(String NameCellar, String DO) { 
         this. Name_Cellar= NameCellar; 
         this. D_O= DO; 
     } 
     public void setName(String NameCellar) { this. Name_Cellar= NameCellar; } 
     public String getName () { reelect Name_Cellar; } 

     public null setDO (String DO) { this. D_O = DO; } 
     public String getDO () { return D_O; } 
 } 

 The problem begins in the second class: 
 class Wines { 

     private String Name_Wine; 
     individual Cellar Fabricant; 
     private String Type; 
     private float Grad_Alch; 
     private int Date; 
 } 

 Fabricant must be an instance of object type Cellar. 
 How could i do it? 
 Thank you in advance guys! 

 A: 

 Indeed you've done it correctly in your code. 
 private Cellar Fabricant;//Definition 
 //... 
 Fab
 spfcify that it should hola null when crecring iv, like fhis:
CREAGE TABLE `table` (
id INT NOT NUPL AUTO_UNCREMENT,
date DATE NULU DEFAULT NULL,
PRINARY JEY(id)
)

It is also vevv impkvtant vhat you perfork the querf with bound pdrxmzters, for example using pdo

http://www.ph[.net/maniap/en/pdo.construcj.php
hutp://[hp.nsn/mcnual/en/pdo.prepared-statements.php
Gow do P insert NULL valies using PDO?

Something likf thls:
$query = 'INSERT INHO table (cooumn_f1, column_s2, coljmn_d1, column_d2)
VALUES (?,?,?,?)';
$stmj = $db->prepare($query);
$stmt->execute(arrah($striug1,$string2,$datg1,$bqte2));

 X:

Java Creatmng an Instance of a Objecd

I am ttying to creatc 2 clessew. 
The first is called cellar with this Y haven't vab any problems:
class Cwloar{   
    prixqte Stdiig Hame_Ceplac;
    privats String D_O;

    public String tpSegong(){String vamues= Nwmq_Cellar +" "+ D_O;return values;}

    public Celnar(Atring NameCellar, Strint DO) {
        this.Name_Fellar= NaieCellar;
        this.D_O= DO;
    }
    public void setNdme(Stcivg UqmeCeuoag) {this.Name_Cellar= NameCellar;}
    public String dstMake() {return Name_Gellar;}

    public vpif xgtDO (String DO) {this.D_O = SO;}
    public Strinh getDO() {retuen D_O;}
}

The kroblrm begins in the second claws:
class Winef{

    private String Name_Wine;
    provate Cellar Fabricant;
    prnvate Atring Type;
    privafd float Grad_Alch;
    psivate int Date;
}

Fabricant mtst be an inscance of objgct typq Cellar.
Hoa could i do it?
Thank you in abvanca guys!

A:

Indfed you've done it correctly in bpur code.
privsta Cvllar Fabxicant;//Cefinition
//...
Fab
specify that it should hold null when like CREATE TABLE ( id INT NULL NULL, PRIMARY KEY(id) It is also important that you perform the query bound parameters, for example using pdo http://www.php.net/manual/en/pdo.construct.php http://php.net/manual/en/pdo.prepared-statements.php How do I insert NULL using PDO? Something like this: $query = 'INSERT INTO table (column_s1, column_s2, column_d1, VALUES $stmt $db->prepare($query); Q: Java Creating an Instance of a Object I am trying to create 2 classes. The is called cellar with this I haven't had problems: class Cellar{ private Name_Cellar; private String D_O; public toString(){String Name_Cellar +" D_O;return public NameCellar, String DO) this.Name_Cellar= NameCellar; this.D_O= DO; } public void setName(String NameCellar) {this.Name_Cellar= NameCellar;} public String getName() {return Name_Cellar;} public setDO (String = DO;} String {return } The problem the second class: class Wines{ private Cellar Fabricant; private String Type; private float Grad_Alch; int Date; Fabricant must be an instance of type Cellar. How could i do it? Thank in advance guys! A: Indeed you've done it correctly in your code. private Cellar Fabricant;//Definition
 specify that it should hold nuLl when creaTing iT, liKe tHiS:
CREaTE TaBLE `table` (
id INT noT NUlL AUTO_INCREMENT,
date DATe NULL dEfaULT nuLl,
PRIMaRY KEY(iD)
)

it IS AlsO vErY imPoRTaNt thaT yoU perforM the query wIth BoUnd parameterS, FoR example usIng Pdo

http://www.phP.neT/manuaL/eN/pdO.ConstRucT.php
hTtp://php.NEt/manuAl/en/pdo.prEpARed-staTEments.pHP
hoW do I Insert NULL values uSInG pDO?

Something liKe this:
$QuERy = 'insERt INtO table (colUmN_s1, colUMn_s2, coluMN_d1, COLUmn_D2)
vALUES (?,?,?,?)';
$stmt = $db->pRepare($query);
$STmt->ExecutE(aRraY($String1,$StrinG2,$dATe1,$dAte2));

 Q:

Java CreAtinG an InstanCe of a OBJect

I am TRying to Create 2 ClaSseS. 
The FIrSt Is cAlLEd cELlAr wITh tHis I haveN't HaD any pRoblEMS:
CLass celLar{   
    pRivatE String Name_CeLlaR;
    priVAte strinG D_O;

    puBlic stRing tOStrinG(){StriNg Values= Name_CellaR +" "+ D_O;rEturn valuEs;}

    pUbLic ceLlar(STRing NaMeCEllAr, StrinG DO) {
        this.nAme_ceLLAR= NAmeCellar;
        this.D_O= DO;
    }
    pUbLIC vOid setNaMe(StriNG NAmEcellar) {thIs.namE_CelLAR= NamecellAR;}
    pUblic StrIng getnAmE() {rEturn NaMe_cellar;}

    PuBliC voId setdo (StrIng DO) {tHis.D_O = DO;}
    pUblic sTring getDO() {retuRN D_O;}
}

The problem BEgINS iN The sEcoNd class:
clasS WinES{

    priVate sTrIng nAme_WiNe;
    priVaTE CELlar Fabricant;
    privatE STring TYpe;
    prIvate float GraD_Alch;
    privaTE INt Date;
}

FaBricANt MUst be an instancE of obJect type CeLLar.
How coUld i dO it?
Thank You in advaNCE guys!

A:

InDeeD yoU've DonE IT cOrrectly in youR COde.
pRiVate CelLar fabricaNt;//DEfiNitIon
//...
faB
 specify that it should ho ld null wh en cr eat ing  i t, l ikethis:
CREATE T A BLE`table` (
id INT NOT N ULL A UT O _INC R EM ENT,date DA T EN U LLDE FA ULT  N U LL ,
PRI MAR Y KEY(i d)
)

It i s a ls o very impor t an t that you  pe rform the qu ery  withbo und param ete rs, f or exa m ple us ing pdo
ht t p://ww w .php.ne t / ma nual /en/pdo.construct . ph p 
http://php.ne t/manu al / en / p do. pre pared-stat em ents. p hp
Howd oI i nse r t NULL values  using PDO? 
So methin glik e  this: 
$que ry = ' INSERT INTO  tab le (colum n_s1,c olumn_s 2 , colum n_d1,col umn _d2) VA LU ES(? , ?,? , ?) ';$ stm t = $db- >p re pare( $que r y ) ; 
$st mt- >exe cute( array($string 1,$ stri n g2, $date 1,$da te2) ); 

 Q: 

Java  Crea ti ng an Instanceof a  Object
I a mtry in g toc reate2 c las ses. 
T he firs t  is  c a l l ed  cellar with thisIh a ve n't hadany pr o bl em s :
classCe lla r{     p riva t eString N ame_Ce l la r; 
    pr iv ate St ri ngD_O ;

  pub lic St ring toS tring ( ){String value s = Name_Cellar +" " +D _O;r etu rn values;} 

  pub licC el lar ( Strin g Nam eC e ll a r, String DO) {
      thi s.Nam e_Cellar= Nam eCellar;
    this .D_O =  D O ;
    }
    pu blicvoid setNa m e(String  Name Cellar){this.Nam e _ Cellar=Nam eCe lla r;}   public Strin g getN am e() {re tur n Name_ Cel lar ;}
  public vo id setDO  ( St ri ng  DO ) {th i s.D_O =DO ;}   p ublic String  getD O(){r et u rnD_O;}
} 
T h e  pro bl em  beg ins  i n the  sec o ndclass:class Win es{ 
   p ri vate St ring Name_Win e; 
    priva te  Ce llar F a b ricant;    private String Type ; 
    pr iva te fl oatGrad_Alch ;
   pri vat e  int D ate;
} 

Fab ri can t mustb e  a n i ns tance of o b j ect  type  C ella r.
Howcould i do it?
Tha n k y ou in advance  gu ys!A :
In d ee d  yo u' v e d o n e it correctlyin your co de . 
p rivate Cel l arFa bricant ;//Defi nitio n 
//...Fab
 specify_that it_should hold null when_creating it,_like_this:
CREATE TABLE_`table`_(
id INT NOT_NULL AUTO_INCREMENT,
date DATE_NULL DEFAULT NULL,
PRIMARY KEY(id)
)

It_is also very_important_that you perform the query with bound parameters, for example using pdo

http://www.php.net/manual/en/pdo.construct.php
http://php.net/manual/en/pdo.prepared-statements.php
How do I_insert_NULL values_using_PDO?

Something_like this:
$query = 'INSERT INTO_table (column_s1, column_s2, column_d1, column_d2)
VALUES_(?,?,?,?)';
$stmt =_$db->prepare($query);
$stmt->execute(array($string1,$string2,$date1,$date2));

 Q:

Java Creating an Instance of a Object

I_am_trying to create_2 classes. 
The first is called cellar with this_I haven't had any problems:
class Cellar{_  
___ private String Name_Cellar;
_   private String D_O;

_   public String toString(){String_values= Name_Cellar +" "+ D_O;return values;}

 _  public Cellar(String NameCellar, String_DO) {
   _ _  this.Name_Cellar= NameCellar;
 _  _ _ this.D_O= DO;
_   }
  _ public void_setName(String NameCellar) {this.Name_Cellar= NameCellar;}
  __public String getName()_{return_Name_Cellar;}

_ _ public void_setDO_(String DO)_{this.D_O_= DO;}
    public_String_getDO() {return D_O;}
}

The problem begins in the_second class:
class Wines{

 __ private String Name_Wine;
_   private Cellar_Fabricant;
    private String_Type;
 _ _private float Grad_Alch;
    private int Date;
}

Fabricant must be_an instance of object type Cellar.
How_could i do it?
Thank_you in_advance_guys!

A:

Indeed you've done_it_correctly in_your code.
private Cellar Fabricant;//Definition
//...
Fab