我正在尝试插入数据。为什么会出错?错误:(1048)列' d_id'不能为空

时间:2017-10-21 16:57:02

标签: php mysql sql

$('.date-own').datepicker({
  minViewMode: 1,
  format: 'yyyy/mm/dd',
  autoclose: true
});



<div id="page-wrapper">
  <div class="row">
    <h1>Add New Distributor</h1>
    <form name="registration" action="" method="post" class="form-inline">
      <div class="form-row">
        <div class="form-group col-md-6">
          <label class="sr-only" for="inlineFormInput">Distributor Name</label>
          <?php   $dist = "SELECT `d_id`, `distributor_name`, `region` FROM `distributor`";
        $statement = $con->prepare($dist);
        $statement->execute();
//bind result variables
        $statement->bind_result($id, $distributor_name, $region);?>
          <select name="distributor_name" class="form-control" required>
                        <option value="">Select a Distributor:</option>
                        <?php while ($statement->fetch()) {
                            echo "<option value=\"{$id} \">{$distributor_name}</option>";
                        } ?>
                    </select></div>
        <?php $statement->close(); ?>
        <div class="form-group col-md-6">
          <select name="pro_name" class="form-control" required>
                        <?php
                        //Select Product
                        $pro = "SELECT `pro_id`, `product_name`, `nsp` FROM `products`";
                        $stat = $con->prepare($pro);
                        $stat->execute();
                        //bind result variables
                        $stat->bind_result($pro_id, $product_name, $nsp);
                        ?>
                        <option value="">Select a Product:</option>
                    <?php while ($stat->fetch()) {
                    echo '<option value="' . $pro_id . '">' . $product_name . '</option>';} ?>
                    </select>
          <?php $stat->close(); ?>
        </div>
        <input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="Current Sales" class="current_sales" required>
        <input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="Closing Balance" class="closing_balance" required>
        <input class="date-own form-control" style="width: 300px;" type="text" placeholder="Select Month" name="date" required>
        <input type="submit" value="submit" name="submit" />
      </div>
    </form>
<!-- Using DateTime picker Bootstrap   -->
  </div>
</div>
&#13;
order_date
&#13;
&#13;
&#13;     d_id,current-salesclosing-balancepro_id $stmt_insert = $con->prepare($sql_insert); //bind parameters for markers, where (s = string, i = integer, d = double, b = blob) $stmt_insert->bind_param('isiii', $id_dist, $date, $curr_sales, $clos_bal, $pro_id); if ($stmt_insert->execute()) { print 'Success!<br />'; } else { die('Error : (' . $con->errno . ') ' . $con->error); $stmt_insert->close(); } ?> )VALUES(?,?,?,?,?)&#34;;

$('.date-own').datepicker({
  minViewMode: 1,
  format: 'yyyy/mm/dd',
  autoclose: true
});

enter image description here

&#13;
&#13;
<div id="page-wrapper">
  <div class="row">
    <h1>Add New Distributor</h1>
    <form name="registration" action="" method="post" class="form-inline">
      <div class="form-row">
        <div class="form-group col-md-6">
          <label class="sr-only" for="inlineFormInput">Distributor Name</label>
          <?php   $dist = "SELECT `d_id`, `distributor_name`, `region` FROM `distributor`";
        $statement = $con->prepare($dist);
        $statement->execute();
//bind result variables
        $statement->bind_result($id, $distributor_name, $region);?>
          <select name="distributor_name" class="form-control" required>
                        <option value="">Select a Distributor:</option>
                        <?php while ($statement->fetch()) {
                            echo "<option value=\"{$id} \">{$distributor_name}</option>";
                        } ?>
                    </select></div>
        <?php $statement->close(); ?>
        <div class="form-group col-md-6">
          <select name="pro_name" class="form-control" required>
                        <?php
                        //Select Product
                        $pro = "SELECT `pro_id`, `product_name`, `nsp` FROM `products`";
                        $stat = $con->prepare($pro);
                        $stat->execute();
                        //bind result variables
                        $stat->bind_result($pro_id, $product_name, $nsp);
                        ?>
                        <option value="">Select a Product:</option>
                    <?php while ($stat->fetch()) {
                    echo '<option value="' . $pro_id . '">' . $product_name . '</option>';} ?>
                    </select>
          <?php $stat->close(); ?>
        </div>
        <input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="Current Sales" class="current_sales" required>
        <input type="text" class="form-control mb-2 mr-sm-2 mb-sm-0" placeholder="Closing Balance" class="closing_balance" required>
        <input class="date-own form-control" style="width: 300px;" type="text" placeholder="Select Month" name="date" required>
        <input type="submit" value="submit" name="submit" />
      </div>
    </form>
<!-- Using DateTime picker Bootstrap   -->
  </div>
</div>
&#13;
int len(Box* head)
{
  int i = 0;
  Box* current = head;
  Box* next = NULL;

  if (current != NULL) {
      next = current->next;
  }

  for(i; next != NULL; i++)
  {
    current = next;
    next = current-> next;
  }
  return i;
}


// Adds an element at the end of the list
void add(Box* head, int value)
{
  Box* current = head;
  Box* next = NULL;

  if (current != NULL) {
      next = current->next;
  }

  while(next != NULL)
  {
    current = next;
    next = current->next;
  }

  Box* auxNode = (Box*) malloc(sizeof(Box*));

  if (auxNode == NULL)
  {
    printf("Memory failure\n");
  }
  auxNode->id = value;
  auxNode->next = NULL;

  current->next = auxNode;

}
&#13;
&#13;
&#13;

0 个答案:

没有答案