0

When I register to the database via PHP form, all the data is saved without problems and the picture is moved to the folder, but the picture path does not appear in MySQL. It looks like an Array.

This is my code (also here):

<?php 
if($_POST)
{
    $cins_adi = strip_tags($_POST['cins_adi']);
    $cins_digerad = strip_tags($_POST['cins_digerad']);
    $cins_renk = strip_tags($_POST['cins_renk']);
    $cins_ulke = strip_tags($_POST['cins_ulke']);
    $cins_tarih = strip_tags($_POST['cins_tarih']);
    $cins_familya = strip_tags($_POST['cins_familya']);
    $cins_islev = strip_tags($_POST['cins_islev']);
    $cins_g_islev = strip_tags($_POST['cins_g_islev']);
    $cins_omur = strip_tags($_POST['cins_omur']);
    $cins_kilo = strip_tags($_POST['cins_kilo']);
    $cins_boy = strip_tags($_POST['cins_boy']);
    $cins_aciklama = strip_tags($_POST['cins_aciklama']);  

    $cins_foto = ($_FILES['cins_foto']);

    if($cins_foto['name']!="")
    {
        $foo = new Upload($cins_foto); 

        if ($foo->uploaded)
        {
            $foo->Process('./img');

            if ($foo->processed)
            {
                echo "<p class=\"bg-success\" style=\"height:30px; font-weight: bolder; font-size:20px; line-height:30px; text-align:center;\">Fotoğraf başarıyla yüklendi.</p>";
            }
            else
            {
                echo 'Hata : ' . $foo->error;
            }
        }
    }

    if($cins_adi !="" and $cins_digerad !="" and $cins_renk !="" and $cins_ulke !="" and $cins_tarih !="" and $cins_familya !="" and $cins_islev !="" and $cins_g_islev !="" and $cins_omur !="" and $cins_kilo !="" and $cins_boy !="" and $cins_aciklama !="" and $cins_foto !="")
    {
        $sorgu = $baglanti->db->prepare("insert into cinsler(cins_adi,cins_digerad,cins_renk,cins_ulke,cins_tarih,cins_familya,cins_islev,cins_g_islev,cins_omur,cins_kilo,cins_boy,cins_aciklama,cins_foto) values (?,?,?,?,?,?,?,?,?,?,?,?,?)");

        $ekle = $sorgu->execute(array($cins_adi,$cins_digerad,$cins_renk,$cins_ulke,$cins_tarih,$cins_familya,$cins_islev,$cins_g_islev,$cins_omur,$cins_kilo,$cins_boy,$cins_aciklama,$cins_foto));

        if($ekle)
        {
            echo "<p class=\"bg-success\" style=\"height:30px; font-weight: bolder; font-size:20px; line-height:30px; text-align:center;\">Kayıt başarılı.</p>";
        }
        else
        {
            echo "<p class=\"bg-danger\" style=\"height:30px; font-weight: bolder; font-size:20px; line-height:30px; text-align:center;\">Kayıt başarısız.</p>";
        }
    }
    else
    {
        echo "<p class=\"bg-danger\" style=\"height:30px; font-weight: bolder; font-size:20px; line-height:30px; text-align:center;\">Lütfen tüm alanları doldurun.</p>";
    }
}
?>
Sebastian Brosch
  • 42,106
  • 15
  • 72
  • 87

0 Answers0