Welcome Guest, Not a member yet? Register   Sign In
What the meaning of this word?
#1

[eluser]Freakniube[/eluser]
Hai i'm new here so if i do anything wrong please let me know first....
Smile

what i gonna ask is what this word mean syntax error, unexpected T_VARIABLE i try to find the word T_variable but i coulnd't find it anywhere....


Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\puri2\system\application\controllers\controltamu.php on line 124
#2

[eluser]InsiteFX[/eluser]
This usally means a coding error like ; or } missing in the code.

You would need to post the code that is giving you the error for us to help you.

InsiteFX
#3

[eluser]Freakniube[/eluser]
hey i upload the file is about 3-4 mb i hope this is okay cause i upload the whole folder....

here's the link http://www.4shared.com/file/RIUdB6zF/puri2.html


and this for the db if you need it...
http://www.4shared.com/document/hIrq9g9N/puri2.html

folder i use is controler,model and view...

any way ths 4 respond...
Smile
#4

[eluser]cideveloper[/eluser]
I know for a fact that I'm not going to some random file sharing site and downloading someones full CI install. Just post the code from controltamu.php here using "code" blocks. Or just look at the file either above, below, or on line 124 and look for missing items like InsiteFX said.
#5

[eluser]Freakniube[/eluser]
i don't have any idea what your thingking,because i just try make you easy to read the code but if you like this way here the code....

Code:
<?php
class Modeltamu extends Model {
    
    function Modeltamu()
    {
        parent::Model();
    }
    
    // Inisialisasi nama tabel yang digunakan
    var $table = 'tamu';
    
    /**
     * Menghitung jumlah baris dalam sebuah tabel, ada kaitannya dengan pagination
     */
    function count_all_num_rows()
    {
        return $this->db->count_all($this->table);
    }
    
    /**
     * Tampilkan 10 baris tamu terkini, diurutkan berdasarkan tanggal (Descending)
     */
    function get_last_ten_tamu($limit, $offset)
    {
        $this->db->select('tamu.id_tamu, tamu.tanggal, tamu.bill, guest.nama, bulan.bulan, tamu.tamu');
        $this->db->from('tamu, guest, kamar, bulan');
        $this->db->where('guest.id_kamar = kamar.id_kamar');
        $this->db->where('tamu.bill = guest.bill');
        $this->db->where('bulan.id_bulan = absen.id_bulan');
        $this->db->order_by('tamu.tanggal', 'desc');
        $this->db->limit($limit, $offset);
        return $this->db->get();
    }
    
    /**
     * Menghapus sebuah entry data tamu
     */
    function delete($id_tamu)
    {
        $this->db->where('id_tamu', $id_tamu);
        $this->db->delete($this->table);
    }
    
    /**
     * Menambahkan sebuah data ke tabel tamu
     */
    function add($tamu)
    {
        $this->db->insert($this->table, $tamu);
    }
    
    /**
     * Dapatkan data tamu dengan id_tamu tertentu, untuk proses update
     */
    function get_tamu_by_id($id_tamu)
    {
        $this->db->select('id_tamu, bill, id_bulan, tanggal, tamu');
        $this->db->where('id_tamu', $id_tamu);
        return $this->db->get($this->table);
    }
    
    /**
     * Update data tamu
     */
    function update($id_tamu, $tamu)
    {
        $this->db->where('id_tamu', $id_tamu);
        $this->db->update($this->table, $tamu);
    }
    
    /**
     * Cek apakah ada entry data yang sama pada tanggal tertentu untuk guest dengan bill tertentu pula
     */
    function valid_entry($bill, $tanggal)
    {
        $this->db->where('bill', $bill);
        $this->db->where('tanggal', $tanggal);
        $query = $this->db->get($this->table)->num_rows();
                        
        if($query > 0)
        {
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }    
}

any way this diffrent from link above.Controltamu.php i changed with tamu.php.
yesterday i try to add more php to CI like guest.php,modelguest.php,formguest.php and few more(of course login page i have add it) but the output not error like this (Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\puri2\system\application\controllers\controltamu.php on line 124)

but change to

A Database Error Occurred

Error Number: 1054

Unknown column 'bulan.bulan' in 'field list'

SELECT `tamu`.`id_tamu`, `tamu`.`tanggal`, `tamu`.`bill`, `guest`.`nama`, `bulan`.`bulan`, `tamu`.`tamu` FROM (`tamu`, `guest`, `kamar`, `bulan`) WHERE `guest`.`id_kamar` = kamar.id_kamar AND `tamu`.`bill` = guest.bill AND `bulan`.`id_bulan` = absen.id_bulan ORDER BY `tamu`.`tanggal` desc LIMIT 10

this morning (gmt7) i try to change the db but i haven't found the problem,but i think the problem is db not the code....
what do you think?
thx for the reply btw
#6

[eluser]InsiteFX[/eluser]
This should be before your Constructor, variables are always first.
Code:
// Inisialisasi nama tabel yang digunakan
    var $table = 'tamu';

    function Modeltamu()
    {
        parent::Model();
    }

Also your where is wrong! Active Record will add the = sign for you.
Code:
$this->db->where('guest.id_kamar', 'kamar.id_kamar');
$this->db->where('tamu.bill', 'guest.bill');
$this->db->where('bulan.id_bulan', 'absen.id_bulan');

And this also is wrong!
Code:
function valid_entry($bill, $tanggal)
    {
        $this->db->where('bill', $bill);
        $this->db->where('tanggal', $tanggal);

        $query = $this->db->get($this->table);
                        
        if($query->num_rows() > 0)
        {
            return TRUE; // num_rows() is > than 0
        }
        else
        {
            return FALSE; // num_rows() is less than 0 or equals 0
        }
    }

You need to read the CodeIgniter User Guide on Active Record.

InsiteFX
#7

[eluser]Freakniube[/eluser]
for mr.fx sry the code in above is for folder model (modeltamu.php) this for folder controller(tamu.php)
Code:
class Tamu extends Controller {
    /**
     * Constructor
     */
    function Tamu()
    {
        parent::Controller();
        $this->load->model('Modeltamu', '', TRUE);
        $this->load->model('Modelbulan', '', TRUE);
        $this->load->model('Modelguest', '', TRUE);
    }
    
    /**
     * Inisialisasi variabel untuk $limit dan $title(untuk id element <body>)
     */
    var $limit = 10;
    var $title = 'tamu';
    
    /**
     * Memeriksa user state, jika dalam keadaan login akan menampilkan halaman tamu,
     * jika tidak akan meredirect ke halaman login
     */
    function index()
    {
        // Hapus data session yang digunakan pada proses update data tamu
        $this->session->unset_userdata('id_tamu');
        $this->session->unset_userdata('tanggal');
            
        if ($this->session->userdata('login') == TRUE)
        {
            $this->get_last_ten_tamu();
        }
        else
        {
            redirect('login');
        }
    }


and this is also wrong?

Code:
foreach ($tamus as $tamu)
            {
                // Konversi hari dan tanggal ke dalam format Indonesia
                $hari_array = array('Minggu', 'Senin', 'Selasa', 'Rabu', 'Kamis', 'Jumat', 'Sabtu');
                $hr = date('w', strtotime($absen->tanggal));
                $hari = $hari_array[$hr];
                $tgl = date('d-m-Y', strtotime($tamu->tanggal));
                $hr_tgl = "$hari, $tgl";
                
                // Penyusunan data baris per baris, perhatikan pembuatan link untuk updat dan delete
                $this->table->add_row(++$i, $hr_tgl, $tamu->bill, $tamu->nama, $tamu->kamar, $tamu->tamu,
                                        anchor('tamu/update/'.$tamu->id_tamu,'update',array('class' => 'update')).' '.
                                        anchor('tamu/delete/'.$tamu->id_tamu,'hapus',array('class'=> 'delete','onclick'=>"return confirm('Anda yakin akan menghapus data ini?')"))
                                    );
            }
            $data['table'] = $this->table->generate();
        }
        else
        {
            $data['message'] = 'Tidak ditemukan satupun data tamu!';
        }

that means this alsi wrong right??
Code:
function valid_entry()
    {
        $bill         = $this->input->post('bill');
        $tanggal    = date('Y-m-d', strtotime($this->input->post('tanggal')));
        
        if($this->Modeltamu->valid_entry($bill, $tanggal) == FALSE)
        {
            $this->form_validation->set_message('valid_entry', 'Guest ini sudah tercatat tamu pada tanggal ' . $this->input->post('tanggal'));
            return FALSE;
        }
        else
        {
            return TRUE;
        }
    }
    
    /**
     * Cek agar tidak terjadi guest dengan BILL yang sama ditambah 2 kali ke tamu, hanya untuk proses update
     */
    function valid_entry2()
    {
        $current_date     = $this->session->userdata('tanggal');
        $new_date        = date('Y-m-d', strtotime($this->input->post('tanggal')));
        $bill             = $this->input->post('bill');
        
        if ($new_date === $current_date)
        {
            return TRUE;
        }
        else
        {
            if($this->Modeltamu->valid_entry($bill, $new_date) === FALSE) // cek database untuk entry yang sama memakai valid_entry()
            {
                $this->form_validation->set_message('valid_entry2', 'Guest ini sudah tercatat tamu pada tanggal ' . $this->input->post('tanggal'));
                return FALSE;
            }
            else
            {
                return TRUE;
            }
        }
    }    
}
// END Tamu Class

/* End of file tamu.php */
/* Location: ./system/application/controllers/tamu.php */
#8

[eluser]Freakniube[/eluser]
mr.fx do you mean this word just removed form modeltamu.php?
Code:
$this->db->where('guest.id_kamar', 'kamar.id_kamar');
$this->db->where('tamu.bill', 'guest.bill');
$this->db->where('bulan.id_bulan', 'absen.id_bulan');
#9

[eluser]Niube[/eluser]
Thx 4 all reply but i have solved this problem.....
Big Grin




Theme © iAndrew 2016 - Forum software by © MyBB