Tamam, bu gerçekten kafa karıştırıcı geliyor. Ne yapmaya çalışıyorum bu. Ben yüklenenler / sunucu fotoğrafları boyutlandırır bir işlevi var. Bu DB yollarını saklayan. Ben fotoğraf satır iş id eklemek gerekir.
İşte ben bugüne kadar ne var:
function get_bus_id() {
$userid = $this->tank_auth->get_user_id();
$this->db->select('b.id');
$this->db->from ('business AS b');
$this->db->where ('b.userid', $userid);
$query = $this->db->get();
if ($query->num_rows() > 0) {
// RESULT ARRAY RETURN A MULTIDIMENSIONAL ARRAY e.g. ARRAY OF DB RECORDS
// ( ROWS ), SO IT DOENS'T FIT
//return $query->result_array();
// THE CORRECT METHOD IS row_array(), THAT RETURN THE FIRST ROW OF THE
// RECORDSET
$query->row_array();
}
Yani olsun iş kimliği bulunuyor. Sonra, aşağıda benim yükleme işlevi vardır:
/* Uploads images to the site and adds to the database. */
function do_upload() {
$config = array(
'allowed_types' => 'jpg|jpeg|gif|png',
'upload_path' => $this->gallery_path,
'max_size' => 2000
);
$this->load->library('upload', $config);
$this->upload->do_upload();
$image_data = $this->upload->data();
$config = array(
'source_image' => $image_data['full_path'],
'new_image' => $this->gallery_path . '/thumbs',
'maintain_ratio' => true,
'width' => 150,
'height' => 100
);
$this->load->library('image_lib', $config);
$this->image_lib->resize();
$upload = $this->upload->data();
$bus_id = $this->get_bus_id();
$data = array(
'userid' => $this->tank_auth->get_user_id(),
'thumb' => $this->gallery_path . '/thumbs/' . $upload['file_name'],
'fullsize' => $upload['full_path'],
'busid'=> $bus_id['id'],
);
echo var_dump($bus_id);
$this->db->insert('photos', $data);
}
Ben alıyorum sorun şudur:
Bir PHP hata ile karşılaşıldı
Önem: Bildirimi
Mesaj: Undefined index: id
Dosya Adı: modelleri / gallery_model.php
Satır sayısı: 48
Ben değeri üzerinden almak için yollar her türlü denedim, ama benim sınırlı bilgim şekilde olmaya devam ediyor. Herhangi bir Yardım gerçekten takdir.