php - Incorrect integer value: '' for column 'Did' at row 1 -


i have site built 9 years ago , since dedicated server has had many updates, php, myqsl, ect... , database driven site having small issues. know need rebuild it, can issues. when try add product backend, error message:

incorrect integer value: '' column 'did' @ row 1

i have column in database called 'did' not sure think. here code add product on backend:

<?  include("../config.php");  if(isset($_post[are]))  {  $cid                        = $_post[cid]; $sid                        = $_post[sid]; $design_image               = $_files[design_image][name]; $dimensionw                 = $_post[dimensionw]; $dimensiony                 = $_post[dimensiony]; $model_number               = $_post[model_number]; $new_design                 = $_post[new_design]; $t                          = time();        function getfileextension($str) {          $i = strrpos($str,".");          if (!$i) { return ""; }          $l = strlen($str) - $i;          $ext = substr($str,$i+1,$l);          $ext = strtolower($ext);          if($ext == jpg || $ext == jpeg || $ext == gif || $ext == png)          {          }          else          {          echo"<strong>$ext</strong> type not accepted.please upload jpg, gif , png extenstions";          exit();          }          return $ext;          }          function copyimagefilegd($name,$ext,$path_thumbs,$path_big,$newwidth,$newheight) {          $t       = time();          $tempname = strtolower($name);          $newname = "$tempname$t.$ext";          $temp_type = $_files[$name]['type'];          $temp_name = $_files[$name]['name'];          $temp_size = $_files[$name]['size'];          $temp_tmp = $_files[$name]['tmp_name'];            if($temp_size){            if($temp_type == "image/pjpeg" || $temp_type == "image/jpeg"){                 $new_img = imagecreatefromjpeg($temp_tmp);             }elseif($temp_type == "image/x-png" || $temp_type == "image/png"){                 $new_img = imagecreatefrompng($temp_tmp);             }elseif($temp_type == "image/gif"){                 $new_img = imagecreatefromgif($temp_tmp);             }                      list($width, $height) = getimagesize($temp_tmp);               if (function_exists(imagecreatetruecolor)){             $resized_img = imagecreatetruecolor($newwidth,$newheight);             }             imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);             $tempname = strtolower($name);             $newname = "$tempname$t.$ext";                       imagejpeg ($resized_img,"$path_thumbs/$newname");             imagedestroy ($resized_img);             imagedestroy ($new_img);               }               return $newname;                         }                    $extdesign_image = getfileextension($design_image);             if(!empty($design_image))          {          $newdesign_image = copyimagefilegd("design_image","$extdesign_image","../designs_files/thumbs","../designs_files","150","160");          }            $q1 = "insert `designs` (`did` , `cid` , `sid` , `design_image` , `dimensionw` , `dimensiony` , `model_number` , `order` , `new_design` ) values ( '', '$cid', '$_post[sid]', '$newdesign_image', '$dimensionw', '$dimensiony', '$model_number', '', '$new_design')"; mysql_query($q1) or die(mysql_error());        $qp = "select last_insert_id()";     $rp = mysql_query($qp) or die(mysql_error());     $ap = mysql_fetch_array($rp);             $q1 = "update `designs` set            `order`          = '$ap[0]'            `did`          = '$ap[0]'";         mysql_query($q1) or die(mysql_error());   header("location:designs.php");  }  else  {  include("header.php");  include("designsnav.php");           $qcid = "select * `categories` order title";         $rcid = mysql_query($qcid) or die(mysql_error());         if(mysql_num_rows($rcid) == '0')         {              echo "<br><center><b>no category found in database.</b></center>";             include"footer.php";             exit();         }                  else         {         $cidoption .='<select size="1" name="cid" id="cid" onchange="selectchange(this, form.sid, arritems1, arritemsgrp1);">         <option value="0" selected>[ select 1 ]</option>         ';         while($acid = mysql_fetch_array($rcid))         {           $cidoption .="\t<option value=\"$acid[cid]\">$acid[title]</option>\n";         }          $cidoption .='</select>';                }           ?>          <script type="text/javascript">  var arritems1 = new array(); var arritemsgrp1 = new array(); function selectchange(control, controltopopulate, itemarray, grouparray) { alert("hello");   var myele ;   var x ;   // empty second drop down box of choices   (var q=controltopopulate.options.length;q>=0;q--) controltopopulate.options[q]=null;    // add default choice - in case there no values   myele = document.createelement("option") ;   myele.value = 0 ;   myele.text = "[ select 1 ]" ;   // controltopopulate.add(myele) ;   controltopopulate.appendchild(myele)   // loop through array of individual items   // containing same child id added   // second dropdown box   ( x = 0 ; x < itemarray.length  ; x++ ) {     if ( grouparray[x] == control.value ) {       myele = document.createelement("option") ;       //myele.value = x ;       myele.setattribute('value',x);       // myele.text = itemarray[x] ;       var txt = document.createtextnode(itemarray[x]);       myele.appendchild(txt)       // controltopopulate.add(myele) ;       controltopopulate.appendchild(myele)     }   } }           </script>           <?php         $qsid = "select * `subcategories` order cid";         $rsid = mysql_query($qsid) or die(mysql_error());         if(mysql_num_rows($rsid) == '0')         {              echo "<br><center><b>no category found in database.</b></center>";             include"footer.php";             exit();         }                  else         {         while($asid = mysql_fetch_array($rsid))         {           $sidoption .="          arritems1[$asid[sid]] = \"$asid[title]\";          arritemsgrp1[$asid[sid]] = \"$asid[cid]\";          ";         }           }           ?> <script type="text/javascript">    <?echo $sidoption;?>    /* function selectchange(control, controltopopulate, itemarray, grouparray) {   var myele ;   var x ;   // empty second drop down box of choices   (var q=controltopopulate.options.length;q>=0;q--) controltopopulate.options[q]=null;   if (control.name == "cid") {     // empty third drop down box of choices   }   // add default choice - in case there no values   myele=document.createelement("option");   thetext=document.createtextnode("[ select 1 ]");   myele.appendchild(thetext);   myele.setattribute("value","0");   controltopopulate.appendchild(myele);   // loop through array of individual items   // containing same child id added   // second dropdown box   ( x = 0 ; x < itemarray.length  ; x++ ) {     if ( grouparray[x] == control.value ) {       myele = document.createelement("option") ;       //myele.value = x ;       myele.setattribute("value",x);       // myele.text = itemarray[x] ;       var txt = document.createtextnode(itemarray[x]);       myele.appendchild(txt)       // controltopopulate.add(myele) ;       controltopopulate.appendchild(myele)     }   } } */  </script>    <form name="form" method="post" enctype="multipart/form-data" action="adddesigns.php">  <table border="0" width="600">  <tr> <td width="252">categories:</td> <td width="549"><?echo $cidoption;?>     </td> </tr>  <tr> <td width="252">sub categories:</td> <td width="549">       <select id="sid" name="sid">       </select> </td> </tr>  <tr> <td width="252">design image:</td> <td width="549"><input type="file" name="design_image" size="20"></td> </tr>  <tr> <td width="252">dimensions:</td> <td width="549"><input type="text" name="dimensionw" size="3" maxlength="15">  width  <input type="text" name="dimensiony" size="3" maxlength="15"> height </td> </tr>   <tr> <td width="252">model number:</td> <td width="549"><input type="text" name="model_number" size="15" maxlength="50"></td> </tr>  <tr> <td width="252">new design:</td> <td width="549"><input type="checkbox" name="new_design" value="yes"></td> </tr>        <tr>         <td width="252">&nbsp;</td>        <td width="549">&nbsp;</td>      </tr>      <tr>         <td width="252">&nbsp;</td>        <td width="549"><input type="submit" value="add designs" name="are"></td>      </tr>  </table>  </form>  <?  include("footer.php");  }  ?> 


Comments

Popular posts from this blog

java - Jasper subreport showing only one entry from the JSON data source when embedded in the Title band -

mapreduce - Resource manager does not transit to active state from standby -

serialization - Convert Any type in scala to Array[Byte] and back -