title: NULL insertion into a Column which has Varchar data type
body: <p>I am inserting some data into mysql database through php. The problem is that when I try to insert null value into a column it doesn't store like this :<em>NULL</em> and it actually saves NULL as text or when I remove the if statement from my php script it insert a free space in that column.
  Here is my PHP code :</p>
  
  <pre><code>&lt;?php
  
  register();
  
  function connectToDatabase(){
  $connection=mysqli_connect("localhost","username","pass","db");
  if (mysqli_connect_errno()) {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  mysqli_set_charset($connection,"utf8");
  return $connection;
  }
  
  
  function register(){
  
  $connection = connectToDatabase();
  $OrgID = $_REQUEST['OrgID'];
  $OrgName = $_REQUEST['OrgName'];
  $OrgAddress = $_REQUEST['OrgAddress'];
  $OrgPhone = $_REQUEST['OrgPhone'];
  
  
  if($OrgName!=""){
  
      $check = mysqli_query($connection,"select count(*) from organization  where org_name='$OrgName'");
      $row = mysqli_fetch_array($check);
      if($row[0]&gt;=1){
  
          print "old_user";
  
      }else {
  
          $result = mysqli_query($connection,"insert into organization (org_id,org_name,org_address,org_phone) values('$OrgID','$OrgName','$OrgAddress','$OrgPhone')");
  
          if($result!=""){
              print "ok";
          }else if($result==""){
              print "no";
          }
  
          mysqli_close($connection);
      }
  
  }else {
      print "null";
  }
  
  }
  
  ?&gt;
  </code></pre>
  
  <p>And when I put the if statement to check for like this it saves the NULL as a text:</p>
  
  <pre><code>if($OrgID == '')
  {
      $OrgID = 'NULL';    
  }
  </code></pre>
  
  <p>And this is my Table structure : </p>
  
  <pre><code>CREATE TABLE IF NOT EXISTS `organization` (
  `org_pid` int(11) NOT NULL AUTO_INCREMENT,
  `org_id` varchar(16) DEFAULT NULL,
  `org_name` varchar(45) NOT NULL,
  `org_address` varchar(255) DEFAULT NULL,
  `org_phone` varchar(45) NOT NULL,
   PRIMARY KEY (`org_pid`)
  ) ENGINE=InnoDB  DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ;
  </code></pre>