Where am i doing wrong ? Count($sepetler) => 2 row.İts ok.Not problem here values key in variables truth not problem here.But not working exec.All of code here.I trust to $sepet array and variables but.İnsert statement is problem.Please help me for find eror
$dbConfig=new DBConfig();
$baglanti = new PDO("mysql:host=".$dbConfig->host.";dbname=".$dbConfig->dbname, $dbConfig->dbuser, $dbConfig->password);
$baglanti->exec("SET NAMES utf8");
$baglanti->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$siparis_kodu=$post["merchant_oid"];
$sepetGetirSql = "select * from sepetler where siparis_kodu='".$siparis_kodu."'";
//
$sepetler = array();
$queryResultSepetList = $baglanti->query( $sepetGetirSql, PDO::FETCH_ASSOC );
if ( $queryResultSepetList->rowCount() > 0 ) {
foreach ( $queryResultSepetList as $row ) {
array_push( $sepetler, $row );
}
}
$sepet_say=count($sepetler);
for ($i=0; $i <count($sepetler) ; $i++) {
$statement = $baglanti->prepare("SELECT urun_adi,urun_fiyati FROM urunler WHERE urun_id = :urun_id");
$statement->execute(array( ":urun_id" => $sepetler[0]["urun_id"] ));
$urun_bilgileri = $statement->fetch(PDO::FETCH_ASSOC);
$query = $baglanti->prepare("INSERT INTO siparisler SET
urun_id = ?,
miktar = ?,
urun_fiyati = ?,
siparis_kodu = ?,
kargo_takip_no = ?,
odeme_durumu = ?,
uye_id = ?");
$insert = $query->execute(array(
$sepetler[$i]["urun_id"], $sepetler[$i]["miktar"], $urun_bilgileri["urun_fiyati"],$sepetler[$i]["siparis_kodu"],"",0,$sepetler[$i]["uye_id"]
));
$mesaj="başarılı sipariş";
}