• 14-12-2023, 09:37:49
    #1
    Selamlar herkese, aşağıdaki ilettiğim hatayı bir türlü çözümleyemedim, konuyla ilgili yardımcı olabilirseniz çok sevinirim

    Yapmak istediğim ise tabloya veritabanındaki mevcutadet sütunundaki değer 0 a eşitse stok yok yazdırmak istiyorum fakat mevcutadet tablosundaki veriyi bir türlü yazdırıp eşit olup olmadığını kontrol ettiremedim.
    Warning: Undefined array key "mevcutadet" in hatası alıyorum.

                                <td><?php
                                    $mevcutadet = $_GET['mevcutadet'];
                                    if ($mevcutadet == 0) { 
                                        echo "Stok Yok!";
                                    } else {
                                        echo "$mevcutadet Adet";
                                    }
                                    ?>
                                </td>
  • 14-12-2023, 09:38:42
    #2
    profilimdeki whatsapptan yazarsanız yardımcı olabilirim
  • 14-12-2023, 09:39:10
    #3
    <td><?php
        // $_GET dizisinde "mevcutadet" adında bir anahtar var mı kontrol et
        if (isset($_GET['mevcutadet'])) {
            $mevcutadet = $_GET['mevcutadet'];
            
            if ($mevcutadet == 0) { 
                echo "Stok Yok!";
            } else {
                echo "$mevcutadet Adet";
            }
        } else {
            // "mevcutadet" parametresi belirtilmemişse hata mesajı yazdır
            echo "Parametre bulunamadı!";
        }
    ?></td>
  • 14-12-2023, 09:41:22
    #4
    $mevcutadet = isset($_GET['mevcutadet']) ? $_GET['mevcutadet'] : '';
    if (empty($mevcutadet) || $mevcutadet == 0) {
         echo "Stok Yok!";
     } else {
        echo "$mevcutadet Adet";
    }
  • 14-12-2023, 09:41:30
    #5
    Get fonksiyonu tablodaki veriyi çekmez hocam siz ?mevcutadet=1 tarzında url kısmındaki veriyi kontrol etmişsiniz
  • 14-12-2023, 09:46:05
    #6
    DiZiNi adlı üyeden alıntı: mesajı görüntüle
    <td><?php
        // $_GET dizisinde "mevcutadet" adında bir anahtar var mı kontrol et
        if (isset($_GET['mevcutadet'])) {
            $mevcutadet = $_GET['mevcutadet'];
            
            if ($mevcutadet == 0) {
                echo "Stok Yok!";
            } else {
                echo "$mevcutadet Adet";
            }
        } else {
            // "mevcutadet" parametresi belirtilmemişse hata mesajı yazdır
            echo "Parametre bulunamadı!";
        }
    ?></td>
    Hocam bunu yazdığımda parametre bulunamadı hatası aldım
  • 14-12-2023, 09:46:39
    #7
    SNDizayn adlı üyeden alıntı: mesajı görüntüle
    $mevcutadet = isset($_GET['mevcutadet']) ? $_GET['mevcutadet'] : '';
    if (empty($mevcutadet) || $mevcutadet == 0) {
         echo "Stok Yok!";
     } else {
        echo "$mevcutadet Adet";
    }
    bunu yazdığımda ise hepsine stok yok diye yazdırıyor
  • 14-12-2023, 09:51:03
    #8
    canbicerr adlı üyeden alıntı: mesajı görüntüle
    bunu yazdığımda ise hepsine stok yok diye yazdırıyor
    pardon yanlış okumuşum.
    veritabanından $_GET ile veri çekilmez gözden kaçırdığınız biryer var kodun tamamını verebilirseniz daha net çözüm üretebiliriz.
  • 14-12-2023, 09:55:37
    #9
    SNDizayn adlı üyeden alıntı: mesajı görüntüle
    pardon yanlış okumuşum.
    veritabanından $_GET ile veri çekilmez gözden kaçırdığınız biryer var kodun tamamını verebilirseniz daha net çözüm üretebiliriz.
    tabi hocam, kodun tamamı aşağıdaki gibi.

    <?php
    define("DATA","data/");
    session_start();
    
    include('veritabani.php');
    
    // Validating Session
    
    if(strlen($_SESSION['userlogin'])==0)
    
    {
    
    header('location:giris-yap.php');
    
    }
    
    else{
    
    ?>
    
    <!DOCTYPE html>
    <html lang="en">
        <head>
            <meta charset="utf-8" />
            <title>Dashboard</title>
            <meta name="viewport" content="width=device-width, initial-scale=1.0">
            <meta http-equiv="X-UA-Compatible" content="IE=edge" />
            <!-- App favicon -->
            <link rel="shortcut icon" href="assets/images/favicon.ico">
    
            <!-- App css -->
            <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" id="bootstrap-stylesheet" />
            <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" />
            <link href="assets/css/app.min.css" rel="stylesheet" type="text/css"  id="app-stylesheet" />
    
        </head>
    
       <body class="left-side-menu-dark topbar-light">
    
        <body>
    
            <!-- Begin page -->
            <div id="wrapper">
    
    <?php            
    include_once(DATA."header.php");
    ?>
    
    <?php            
    include_once(DATA."sidebar.php");
    ?>            
              
                </div>
    
                <div class="content-page">
                    <div class="content">
                        
                        <!-- Start Content-->
                        <div class="container-fluid">
                            
                            <!-- start page title -->
                            <div class="row">
                                <div class="col-12">
                                    <div class="page-title-box">
                                        <div class="page-title-right">
                                            <ol class="breadcrumb m-0">
                                                <li class="breadcrumb-item"><a href="javascript: void(0);">Uplon</a></li>
                                                <li class="breadcrumb-item active">Dashboard</li>
                                            </ol>
                                        </div>
                                        <h4 class="page-title">Dashboard</h4>
                                    </div>
                                </div>
                            </div>     
                            <!-- end page title --> 
    
                                <div class="col-xl-5">
                                    <div class="card-box">
    
                                        <h4 class="header-title mb-3">Top Contracts</h4>
    
                                        <div class="table-responsive">
                                            <table class="table mb-0 table-sm mb-0">
                                                <thead>
                                                    <tr>
                                                        <th>#</th>
                                                        <th>Ürünler</th>
                                                        <th>Mevcut Stok</th>
                                                        <th>İşlem</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
    
                                                   <?php
    
                                  $envlistesi = $vtbaglanti->prepare("SELECT * FROM stok HAVING mevcutadet < 10 ORDER BY mevcutadet ASC");
                                  $envlistesi->execute();
                     
                                 while ($cek = $envlistesi->fetch(PDO::FETCH_OBJ)) {?>
                            
                        <tr>
                                <th scope="row"><?=$cek->id?></th>
                                <td><?=$cek->urunler?></td>
                                <td><?php
                                $mevcutadet = isset($_GET['mevcutadet']) ? $_GET['mevcutadet'] : '';
                                if (empty($mevcutadet) || $mevcutadet == 0) {
                                 echo "Stok Yok!";
                                } else {
                                echo "$mevcutadet Adet";
                                }
                                ?></td>
                                <td><a href="envanterduzenle.php?id=<?=$cek->id?>"><button type="button" class="btn btn-info btn-xs"    ><i class="fas fa-pencil-alt"></i> Stok Düzenle</button></a></td>
                        </tr>
                      
                         <?php } ?>
                                                </tbody>
                                            </table>
                                        </div>
                                    </div>
                                </div><!-- end col-->
    
                            </div>
                            <!-- end row -->
                            
                        </div> <!-- end container-fluid -->
    
                    </div> <!-- end content -->
    
                    
    
                    <!-- Footer Start -->
                    <!-- end Footer -->
    
                </div>
    
                <!-- ============================================================== -->
                <!-- End Page content -->
                <!-- ============================================================== -->
    
            </div>
            <!-- END wrapper -->
    
     
    
            <!-- Right bar overlay-->
            <div class="rightbar-overlay"></div>
    
           
    
            <!-- Vendor js -->
            <script src="assets/js/vendor.min.js"></script>
    
            <!--Morris Chart-->
            <script src="assets/libs/morris-js/morris.min.js"></script>
            <script src="assets/libs/raphael/raphael.min.js"></script>
    
            <!-- Dashboard init js-->
            <script src="assets/js/pages/dashboard.init.js"></script>
    
            <!-- App js -->
            <script src="assets/js/app.min.js"></script>
            
        </body>
    </html>
    <?php } ?>