Şimdi Ara

MySQL Kaydetmiyor Hata Nerede Bulamadım !

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
2
Cevap
0
Favori
239
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • MySQL veritabanına aşağıdaki kodlarda $tckimlik değişkeni yokken çalışıyor. Ama bu değişkeni ekstradan ekleyince veritabanına kaydetmiyor hata nerede olabilir ? Yardımcı olursanız sevinirim.

                  <?php 
    //include files
    include("../includes/sessions.php");
    include("../includes/config.php");
    $page = $_SERVER['PHP_SELF'];
    //get site title
    $sql="SELECT * FROM options WHERE name = 'options'";
    $result = $conn->query($sql);
    if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
    $sitename = $row['sitename'];
    $sitetitle = $row['sitetitle'];
    }
    }
    ?>
    <!DOCTYPE html>
    <html lang="tr">
    <head>
    <title><?php echo $sitetitle; ?></title>



    <!-- META SECTION -->

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1">



    <link rel="shortcut icon" href="../img/favicon.png" type="image/x-icon">

    <link rel="icon" href="../img/favicon.png" type="image/x-icon">

    <!-- END META SECTION -->

    <!-- CSS INCLUDE -->

    <link rel="stylesheet" href="../css/styles.css">

    <!-- EOF CSS INCLUDE -->

    </head>

    <body>



    <!-- APP WRAPPER -->

    <div class="app">



    <!-- START APP CONTAINER -->

    <div class="app-container">

    <!-- START SIDEBAR -->

    <?php

    include_once("../includes/sidebar.php");

    ?>

    <!-- END SIDEBAR -->



    <!-- START APP CONTENT -->

    <div class="app-content app-sidebar-left">

    <!-- START APP HEADER -->

    <?php

    include_once("../includes/header.php");

    ?>

    <!-- END APP HEADER -->





    <!-- START PAGE CONTAINER -->

    <div class="container">



    <div class="row">



    <div class="col-md-12">





    <div class="block block-condensed">

    <!-- START HEADING -->

    <div class="app-heading app-heading-small">

    <div class="title">

    <h5>Tüm Müşteriler</h5>

    <p>Özet Bilgi</p>

    </div>

    <div class="heading-elements">

    <a data-test="test" rel="nofollow" style="word-wrap: break-word; text-decoration: underline;" target="_blank" onclick="return dhExternalLinkRedirect(this)" href="/ExternalLinkRedirect?module=pgdcode&messageId=123936263&url=../clients" class="btn btn-default btn-icon-fixed" data-href="../clients" class="btn btn-default btn-icon-fixed"><span class="icon-users"></span> Müşterileri Görüntüle</a>

    </div>



    </div>

    <!-- END HEADING -->





    <div class="block-content">



    <?php

    if(isset($_POST['submit'])) {

    $tckimlik = $_POST['tckimlik'];

    $fname = $_POST['fname'];

    $email = $_POST['email'];

    $phone = $_POST['phone'];



    if($_POST['birthday'] == '') {

    $birthday = $_POST['birthday'];}

    else {

    $var = $_POST['birthday'];

    $date = str_replace('/', '-', $var);

    $birthday = date('Y-m-d', strtotime($date));

    }

    $specialcomments = mysqli_real_escape_string($conn, $_POST['specialcomments']);

    include_once('../includes/config.php');

    $sql = "INSERT INTO clients (agency, tckimlik, fname, email, phone, birthday, specialcomments) VALUES ('$agencyid','$tckimlik','$fname','$email','$phone','$birthday','$specialcomments')";



    if($run = mysqli_query($conn,$sql)){

    echo '<div class="alert alert-success" role="alert">

    <strong><i class="fa fa-smile-o text-primary"></i> Tebrikler!</strong> Yeni Müşteri Başarıyla Eklendi.

    </div>';



    }else{

    echo '<div class="alert alert-danger" role="alert">

    <strong><i class="fa fa-warning text-primary"></i> Olamaz!</strong> Eklenemedi, lütfen tekrar deneyin.

    </div>';



    }



    $sql = "SELECT * FROM clients WHERE email='$email' AND phone='$phone'";

    $result = $conn->query($sql);



    while($row = $result->fetch_assoc()) {

    $clientid= $row['ID'];

    }

    echo '<script type="text/javascript">

    window.location = "../addpolicy/?clientid='.$clientid.'"

    </script>';

    }
    ?>



    <form class="form-horizontal" action="" method="post">


    <div class="form-group">

    <label class="col-md-2 control-label">Tc Kimlik</label>

    <div class="col-md-10">

    <input type="text" class="form-control" name="tckimlik">

    </div>

    </div>

    <div class="form-group">

    <label class="col-md-2 control-label">İsim Soyisim</label>

    <div class="col-md-10">

    <input type="text" class="form-control" name="fname">

    </div>

    </div>

    <div class="form-group">

    <label class="col-md-2 control-label">Email</label>

    <div class="col-md-10">

    <input type="email" class="form-control" name="email">

    </div>

    </div>

    <div class="form-group">

    <label class="col-md-2 control-label">Telefon Numarası (+905555555555)</label>

    <div class="col-md-10">

    <input type="text" class="form-control" value="+90" name="phone">

    </div>

    </div>

    <div class="form-group">

    <label class="col-md-2 control-label">Doğum Tarihi</label>



    <div class="col-md-10">

    <div class="input-group bs-datepicker">

    <input type="text" class="form-control" name="birthday">

    <span class="input-group-addon">

    <span class="icon-calendar-full"></span>

    </span>

    </div></div>

    </div>

    <div class="form-group">

    <label class="col-md-2 control-label">Özel Yorumlar</label>

    <div class="col-md-10">

    <textarea class="form-control" rows="5" name="specialcomments"></textarea>

    </div>

    </div>


    <div class="form-group text-right">

    <div class="col-md-12">

    <button type="submit" name="submit" class="btn btn-primary btn-icon-fixed"><span class="icon-user-plus"></span> Müşteri Ekle</button>

    </div>

    </div>

    </form>

    </div>

    </div>

    </div>

    </div>

    </div>

    </div>

    </div>

    <!-- END PAGE CONTAINER -->



    </div>

    <!-- END APP CONTENT -->



    </div>

    <!-- END APP CONTAINER -->



    <!-- START APP FOOTER -->

    <?php

    include_once("../includes/footer.php");

    ?>

    <!-- END APP FOOTER -->





    <!-- APP OVERLAY -->

    <div class="app-overlay"></div>

    <!-- END APP OVERLAY -->

    </div>

    <!-- END APP WRAPPER -->



    <!-- START SCRIPTS -->

    <script type="text/javascript" src="../js/vendor/jquery/jquery.min.js"></script>

    <script type="text/javascript" src="../js/vendor/jquery/jquery-ui.min.js"></script>

    <script type="text/javascript" src="../js/vendor/bootstrap/bootstrap.min.js"></script>

    <script type="text/javascript" src="../js/vendor/moment/moment.min.js"></script>



    <script type="text/javascript" src="../js/vendor/customscrollbar/jquery.mCustomScrollbar.min.js"></script>

    <script type="text/javascript" src="../js/vendor/bootstrap-select/bootstrap-select.js"></script>

    <script type="text/javascript" src="../js/vendor/bootstrap-datetimepicker/bootstrap-datetimepicker.js"></script>



    <script type="text/javascript" src="../js/vendor/maskedinput/jquery.maskedinput.min.js"></script>

    <script type="text/javascript" src="../js/vendor/form-validator/jquery.form-validator.min.js"></script>



    <script type="text/javascript" src="../js/vendor/noty/jquery.noty.packaged.js"></script>



    <script type="text/javascript" src="../js/vendor/datatables/jquery.dataTables.min.js"></script>

    <script type="text/javascript" src="../js/vendor/datatables/dataTables.bootstrap.min.js"></script>



    <script type="text/javascript" src="../js/vendor/sweetalert/sweetalert.min.js"></script>

    <script type="text/javascript" src="../js/vendor/knob/jquery.knob.min.js"></script>



    <script type="text/javascript" src="../js/vendor/jvectormap/jquery-jvectormap.min.js"></script>

    <script type="text/javascript" src="../js/vendor/jvectormap/jquery-jvectormap-world-mill-en.js"></script>

    <script type="text/javascript" src="../js/vendor/jvectormap/jquery-jvectormap-us-aea-en.js"></script>



    <script type="text/javascript" src="../js/vendor/sparkline/jquery.sparkline.min.js"></script>



    <script type="text/javascript" src="../js/vendor/morris/raphael.min.js"></script>

    <script type="text/javascript" src="../js/vendor/morris/morris.min.js"></script>



    <script type="text/javascript" src="../js/vendor/rickshaw/d3.v3.js"></script>

    <script type="text/javascript" src="../js/vendor/rickshaw/rickshaw.min.js"></script>



    <script type="text/javascript" src="../js/vendor/isotope/isotope.pkgd.min.js"></script>



    <script type="text/javascript" src="../js/app.js"></script>

    <script type="text/javascript" src="../js/app_plugins.js"></script>

    <script type="text/javascript" src="../js/app_demo.js"></script>

    <!-- END SCRIPTS -->

    <script type="text/javascript" src="../js/app_demo_dashboard.js"></script>

    </body>

    </html>







  • kodda sorun yok gibi, mysql de tckimlik in veritipi karakter sınırı vs. kontrol et
  • Yapay Zeka’dan İlgili Konular
    Daha Fazla Göster
    
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.