Jump to content

elkumanes

Miembro
  • Contador contenido

    12
  • Ingreso

  • Última visita

Mensajes publicados por elkumanes

  1. hace 15 horas, caanmasu dijo:

    La query es inválida:

    
    SELECT * FROM player.item pos=:po WHERE owner_id=:ow

    La forma genérica de las consultas tipo SELECT es:

    
    SELECT [columnas] FROM [basededatos.tabla] WHERE [condición]

     

    como deberia de ir 
    
    SELECT owner_id FROM player.item WHERE pos=:po AND owner_id=:ow

    asi me da otro error en otra pagina 

    no se supone que asi SELECT * FROM player.item WHERE pos=:po AND owner_id=:ow  selecciona todas las tablas 

    pero si hagarro y comento la linea 8 el codigo me funciona perfecto.

    esta es la linea 8:  $canta ->execute(array("ow"=>$_SESSION['id'], "po"=>40));

  2. hola amigos estoy implementando una item-sho pero a la hora de hacer la compra me da un error este es el codigo 

    ESTE ES EL ERROR QUE ME DA 

    Fatal error: Uncaught PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '='40' WHERE owner_id='2'' at line 1 in C:\xampp\htdocs\item_shop\sayfalar\urun-satinal.php:8 Stack trace: #0 C:\xampp\htdocs\item_shop\sayfalar\urun-satinal.php(8): PDOStatement->execute(Array) #1 C:\xampp\htdocs\item_shop\index.php(195): require_once('C:\\xampp\\htdocs...') #2 {main} thrown in C:\xampp\htdocs\item_shop\sayfalar\urun-satinal.php on line 8

     

    no se mucho de de PDO por favor sean lo mas claro que puedan gracias........

     

         ESTA ES LA PAGINA urun-satinal.php

    Quote

     

         ESTA ES LA PAGINA urun-satinal.php

    <?php !defined("index") ? die (header('location: ../index.php?getir=404')) : null; ?>
    <?php 
    sleep(1);
    if (isset($_GET['id'])) {
        $id = trim($_GET['id']);

        $canta = $vtOyun ->prepare("SELECT * FROM player.item pos=:po WHERE owner_id=:ow");
        $canta ->execute(array("ow"=>$_SESSION['id'], "po"=>40));
        $bastirCanta = $canta->fetch(PDO::FETCH_ASSOC);

        if (!$id) {
            header("location: index.php?getir=404");
            exit();

        } else {

            if (HesapDetayCek("coins") < indirimci(urunDetayi("item_fiyat"), urunDetayi("item_indirim")) AND urunDetayi("item_odeme_turu") == "EP") {
                EPYOK();

            } elseif(HesapDetayCek("jcoins") < indirimci(urunDetayi("item_fiyat"), urunDetayi("item_indirim")) AND urunDetayi("item_odeme_turu") == "EM"){
                EMYOK();

            } elseif($bastirCanta['pos'] > PozisyonBulucu()){
                echo "nesne market deponuzda yeteri kadar alan yok.";

            } elseif(!urunDetayi("item_kodu")){
                header("location: index.php?getir=404");
                exit();

            } else {

    //itemin kodunu çeker
                $itemkodu= urunDetayi("item_kodu");
        //itemin kaç adet alınacağı bilgisini çeker
                $adet = urunDetayi("item_adet");
        //nesne market deposundaki boşta olan pozisyonu çeker
                $pozisyon = PozisyonBulucu();

                $itemEkle = $vtOyun->prepare("INSERT INTO player.item SET 
                    window=:w, 
                    owner_id = :oi, 
                    count=:c, 
                    vnum=:v, 
                    pos=:p
                    ");
                $sonuc = $itemEkle->execute(array(
                    'w'=>'MALL', 
                    'oi'=>$_SESSION['id'],
                    'c'=>$adet,
                    'v'=>$itemkodu,
                    'p'=>$pozisyon
                ));
    //13.12.2019 item satın alınma sayısını +1 arttıran fonksiyon
                sevilenUrun(urunDetayi("item_id"));
                //sipariş geçmişini oluşturan fonksiyon
                siparisGecmisi();


                if(urunDetayi("item_indirim") > 0 AND urunDetayi("item_odeme_turu") == "EP"){
                    $sex = HesapDetayCek("coins")-(indirimci(urunDetayi("item_fiyat"), urunDetayi("item_indirim")));
                    $sex2 = HesapDetayCek("jcoins")+(indirimci(urunDetayi("item_fiyat"), urunDetayi("item_indirim")));


                    $MiktarSil = $vtOyun ->prepare("UPDATE account.account SET coins=:co, jcoins=:jo WHERE login=:lo");
                    $MiktarSil->execute(array(
                        "co"=>$sex,
                        "jo"=>$sex2,
                        "lo"=>$_SESSION['login']
                    ));

                } elseif(urunDetayi("item_indirim") > 0 AND urunDetayi("item_odeme_turu") == "EM"){
                    $sex2 = HesapDetayCek("jcoins")-(indirimci(urunDetayi("item_fiyat"), urunDetayi("item_indirim")));

                    $MiktarSil = $vtOyun ->prepare("UPDATE account.account SET jcoins=:jo WHERE login=:lo");
                    $MiktarSil->execute(array(
                        "jo"=>$sex2,
                        "lo"=>$_SESSION['login']
                    ));

                } elseif(urunDetayi("item_odeme_turu") == "EP"){
                    $sex = HesapDetayCek("coins")-(urunDetayi("item_fiyat"));
                    $sex2 = HesapDetayCek("jcoins")+(urunDetayi("item_fiyat"));
                    $MiktarSil = $vtOyun ->prepare("UPDATE account.account SET coins=:co, jcoins=:jo WHERE login=:lo");
                    $MiktarSil->execute(array(
                        "co"=>$sex,
                        "jo"=>$sex2,
                        "lo"=>$_SESSION['login']
                    ));

                } elseif(urunDetayi("item_odeme_turu") == "EM"){
                    $sex = HesapDetayCek("jcoins")-(urunDetayi("item_fiyat"));
                    $MiktarSil = $vtOyun ->prepare("UPDATE account.account SET jcoins=:jco WHERE login=:lo");
                    $MiktarSil->execute(array(
                        "jco"=>$sex,
                        "lo"=>$_SESSION['login']
                    ));

                }

                if ($sonuc) {
                    /*echo urunDetayi("item_adet")." x";
                    echo " ".urunDetayi("item_adi");
                    echo " ".urunDetayi("item_fiyat");
                    echo urunDetayi("item_odeme_turu")." 'e";
                    echo " satın alındı."."<br>";*/

                    TAMAM();

                } else {

                    $row = $itemEkle->errorInfo();
                    echo $row[2];
                }
            }

        }
    }

    ?>

     

×
×
  • Crear nuevo...