Sabtu, 07 September 2013

PHP Indonesia - Facebook: [bantuan] agan2 yang ganteng dan yang cantik (klo ...

PHP Indonesia - Facebook
PHP Indonesia is a community for everyone that loves PHP. Our focus is in the PHP world but our topics encompass the entire LAMP stack. Topics include PHP coding, to memcached handling, db optimizations, server stack, web server tuning, code deploying, hosting options and much much more. Youtube Channel : http://www.youtube.com/user/OurPHPIndonesia Twitter : @php_indonesia NOTE: Rules for Wall posting: https://www.facebook.com/groups/35688476100/doc/10151597056316101/ Daftar Keanggotaan : http://www.facebook.com/groups/35688476100/doc/10150671770741101/ 
Marketing Mobile Apps

This online course focuses on marketing efforts that will increase your app's exposure and establish a mobile app marketing plan. Enroll today for $99.
From our sponsors
[bantuan] agan2 yang ganteng dan yang cantik (klo ...
Sep 7th 2013, 13:40, by Jaka Saputra

Jaka Saputra 1:40pm Sep 7
[bantuan]
agan2 yang ganteng dan yang cantik (klo ada)
ane mau tanya nh , script ini salahnya dimana ya :

<?php
session_start();
//fungsi ini digunakan untuk membaca variabel dengan nama cookie_kantong yang apabila kosong
//maka perintah untuk mengupdate tabel kantong dengan mengisi angka 1 pada field kantong berdasarkan id produk akan di jalankan
$ip = $_COOKIE[$cookie_kantong];
if($cookie_kantong==""){

require("config.php");
$cari="select * from tabel_kantong where id=1";
$query=mysql_query($cari);
$tambah="update tabel_kantong set kantong=kantong+1 where id=1";
mysql_query($tambah);

require("config.php");
$cari2="select * from tabel_kantong where id=1";
$query2=mysql_query($cari2);
$row=mysql_fetch_array($query2);
setcookie("cookie_kantong","$row[kantong]");
//buat bayangan cookie di variabel isicookie
$isicookie=$row[kantong];

//tampilkan data produk berdasarkan id produk dari tabel id
$cari="select * from tabel_produk where id=$id";
$hasil=mysql_query($cari);
$row = mysql_fetch_array($hasil);
//tampilkan data produk
$id=$row[id];
$nama=$row[nama];
$harga=$row[harga];
if($hasil){
//membaca file deteksi_pelanggan.php
require("deteksi_pelanggan.php");
//proses untuk menyimpan ke tabel transaksi
$query = "insert into tabel_transaksi (ip, id, jumlah, nama, harga, total)
Values ('$isicookie','$id', 1, '$nama', '$harga', '$total')";
$result = mysql_query($query);
//menuju ke kantong belanja
header("location:kantong_belanja.php");
}
}else{
//fungsi dibawah ini digunakan untuk apabila kondisi pertama tidak termasuk maka akan mengupdate jumlah pembelian berdasarkan produk dengan
//ditambah angka 1 tiap jumlah barang berdasarkan ip dari variabel cookie_kantong
require("config.php");
$id = abs((int) $_GET['id']);
$cari4="select * from tabel_transaksi where id=$id and ip=$cookie_kantong";
$query3=mysql_query($cari4);
if(mysql_num_rows($query3) == 0){
require("input_transaksi.php");
header("location:kantong_belanja.php");
}else{
$id = abs((int) $_GET['id']);
$ubah="update tabel_transaksi set jumlah=jumlah+1, total=total+harga where id=$id and ip=$cookie_kantong";
mysql_query($ubah);
header("location:kantong_belanja.php");
}
}
?>

di browser ada peringatan gini :
http://localhost/oleh-oleh1/deteksi.php?id=&deteksi=

trs Ada peringatan gini juga di browser :
mysql_fetch_array() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\oleh-oleh1\deteksi.php on line 25

You are receiving this email because you subscribed to this feed at blogtrottr.com.

If you no longer wish to receive these emails, you can unsubscribe from this feed, or manage all your subscriptions

Tidak ada komentar:

Posting Komentar