繁体   English   中英

我无法在数据库中插入数据。 我要去哪里错了?

[英]I can't insert data in my database. Where I'm going wrong?

这是我的代码。 我正在使用php 5.4和PDO连接! 我包括我的数据库连接和其他一些我需要的文件。 现在,我有了一个注册表,在其中填写了一些值。 进行了定向,没有出现问题。 但是当我检查没有添加数据库时。 我要去哪里错了?

 <?php
 include'db.php';
 include'header.php';
 require 'vendndodhje.php';

 $VendndodhjeInput = new Vendndodhje();

 if ( !empty($_POST)) {
 // keep track validation errors
 $emerError = null;
 $mbiemerlError = null;
    $dtlError = null;
    $telError = null;
    $emailError = null;
    $vendndodhjeError=null;

    // keep track post values
    $emer = $_POST['emer'];
    $mbiemer = $_POST['mbiemer'];
    $datelindje = $_POST['datelindje'];
    $tel = $_POST['tel'];
    $email = $_POST['email'];
    $Vendndodhje=$_POST['Vendndodhje'];

    //insert values

 if ($valid) {
  $pdo = Database::connect();
   $sql = "INSERT INTO klienti(emer,mbiemer,datelindje,tel,email,Vendndodhje,date_aplikimi) VALUES(?, ?, ?, ?, ?, ?, NOW())";
    $q = $pdo->prepare($sql);
    $q->execute(array($emer, $mbiemer, $datelindje, $tel,$email, $Vendndodhje));
    }
  header("Location: form'.php");
 }
?>

您可以尝试如下操作:

 $(document).ready(function($) { $('#accordion').find('.accordion-toggle').click(function() { //Expand or collapse this panel $(this).next().slideToggle(500); //Hide the other panels $(".accordion-content").not($(this).next()).slideUp(1000); $(".active").removeClass("active"); $("#accordion") .find(".glyphicon") .removeClass("glyphicon-remove-circle") .addClass("glyphicon-plus-sign") $(this) .addClass("active") .find('.glyphicon') .removeClass("glyphicon-plus-sign") .addClass("glyphicon-remove-circle") }); }); 
 .active > .glyphicon{ color:orange; } 
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/> <div id="accordion"> <h4 class="accordion-toggle active"> <span class="glyphicon glyphicon-remove-circle"></span> Wise busy ast both park when an ye no Nay likely her</h4> <div class="accordion-content default"> <p> Cras malesuada ultrices augue molestie risus.</p> </div> <h4 class="accordion-toggle"> <span class="glyphicon glyphicon-plus-sign"> </span> Written enquire painful ye to offuces forming it</h4> <div class="accordion-content"> <p> Lorem ipsum dolor sit amet mauris eu turpis.</p> </div> <h4 class="accordion-toggle"> <span class="glyphicon glyphicon-plus-sign"> </span> In finished on he speaking suitable advanced if happines</h4> <div class="accordion-content"> <p> Vivamus facilisisnibh scelerisque laoreet.</p> </div> <h4 class="accordion-toggle"> <span class="glyphicon glyphicon-plus-sign"> </span> People as period twenty my extent as Set was better</h4> <div class="accordion-content"> <p> Vivamus facilisisnibh scelerisque laoreet.</p> </div> </div> 

将类添加到您的<span class="glyphicon glyphicon-plus-sign MyIcon">然后添加CSS MyIcon:active{background:orange;}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM